Philadelphia police say a 25-year-old woman was shot seven times and died during a shooting rampage by a man who also ambushed a police officer and injured another officer and three other people before he was shot and killed by police.

Police identified the shooter as 25-year-old Nicholas Glenn. They said Glenn walked up to Sgt. Sylvia Young as she sat in her patrol car as part of a task force in west Philadelphia and shot her in the left arm, then shot University of Pennsylvania police officer Ed Miller in the ankle and pelvis.

He also fired into a bar, injuring a security guard, and grabbed a woman and later shot her, then fired into a car, hitting a man and woman. That woman died just before 2 a.m. Saturday. Glenn was then shot in an alley by other officers.

Police said shortly before noon Saturday that the two wounded officers and the three other people injured were in stable condition.

Commissioner Richard Ross said a "rambling" note apparently written by the gunman expressed hatred for police officers and named a probation officer. Ross said, "This is a completely bizarre situation."

Gov. Tom Wolf released a statement on the shooting. He said, "Our thoughts are with the officers and other victims of this horrifying violence. This is a reminder of the danger that those who seek to keep us safe face every day and we are thankful for the law enforcement personnel who put themselves in harms way to protect the people of our commonwealth."