A gunman who targeted police was killed after he ambushed and shot two police officers and four civilians in Philadelphia, killing a bystander.

Police identified the gunman as 25-year-old Nicholas Glenn, according to Philadelphia Police Commissioner Richard Ross.

Glenn ambushed 46-year-old Sgt. Sylvia Young and shot her in the arm and upper body, Ross said.

During Glenn’s attempt to flee after shooting the sergeant, he shot a security guard, a bar patron, and two people inside a vehicle, The Philadelphia Inquirer reported.

Glenn shot and wounded the security guard before he used a bar patron as a shield and later shot her in the leg, Ross said.

The bystanders in the car, a man and a woman, were both hospitalized before the woman in her 20s was pronounced dead, The Inquirer reported. The man remains in critical condition.

Ed Miller, who is the 56-year-old police officer with The University of Pennsylvania, confronted the shooter along with two Philadelphia police officers in an alley and killed the suspect upon firing, according to The Inquirer. Miller was wounded in action.

Ross said a note containing anti-police rhetoric naming a parole officer as a target was found near the scene, The Daily Mail reported.

Mayor Jim Kenney praised police officers and urged them to wear their protective vests.

“Thank you for what you do for us every day, and please, please, please, every shift, please wear your vest,” he said to The Daily Mail. “They will save your life, as we saw tonight.”

Republican presidential candidate Donald Trump offered his condolences to the Penn and Philadelphia police officers in a tweet.