JAMAICA, Queens (PIX11) – Police shot a knife-wielding man after he allegedly stabbed a security guard outside a church in Queens Thursday, NYPD officials said.

The shooting happened in Jamaica outside First Presbyterian Church on 164th Street around 3:40 p.m., police said. Officers shot the 59-year-old man after he advanced toward them with a knife in hand, according to NYPD Chief of Patrol John Chell.

Police said the incident began when a woman saw the knife-wielding man acting erratically in front of the church. The woman went into the church to fetch a security guard. The security guard went outside, confronted the knife-wielding man and was stabbed once in the stomach, according to police.

The security guard went back into the church and someone called 911. Police responded to the location and found the man with the knife.

“The male gets up with his knife, starts waving it at the officers and starts coming toward the officers. Our officers give commands to drop the knife, which he does not,” Chell said.

The officers shot the man twice. He was hospitalized in stable condition.

Chell said the suspect doesn’t have a criminal history with the NYPD, but he does have a documented record of mental illness.

Chell praised the actions of the security guard, who was hospitalized and is expected to be OK.

“The actions of the security guard from the First Presbyterian Church — the administrative building that was occupied with many people — he did a great job in confronting the male with the knife and stopping maybe this male getting into that location and causing more damage,” Chell said.

Man shot dead by police in Brooklyn

The man in Queens was the second person to be shot by NYPD officers on Thursday afternoon. Police shot and killed a 78-year-old man right outside his own apartment in Bedford-Stuyvesant, Brooklyn.

Two NYPD officers responded to the apartment on Lewis Avenue after a 911 caller said someone was breaking into his uncle’s home there, police officials said. The officers knocked on the apartment and the 78-year-old man opened the door with a gun in hand, according to NYPD Chief of Department Jeffrey Maddrey.

“A male opens the door. He opens the door partially. His body is turned to the side. His left hand is down to the side of his body,” Maddrey said. “The male starts to raise up his left hand, and he has a firearm in his hand. Our officers observed the firearm. They started yelling ‘no!’ They start retreating. The male raises the firearm up and actually steps out of the apartment with the firearm pointed at the officers.”

The two officers shot the man multiple times after he pointed the gun at them, according to Maddrey. The man was pronounced dead at a hospital.

The 78-year-old man was not the possible robbery suspect mentioned in the initial 911 call, officials said. He was the person who actually lived in the apartment. Police believe the man they killed was the uncle who the 911 caller was referring to.

“This is a tragic situation. Our officers were put in a life-or-death situation investigating a crime in progress,” Maddrey said. “Hopefully as our investigative units start to unravel exactly what happened here, we’ll learn more about the male here, we’ll learn more about exactly what happened.”