A gunnman first ambushed a Philadelphia police sergeant late Friday night and then went on a shooting rampage killing a young woman and wounding two law enforcement officers and three other civilians before police shot him to death.

Philadelphia Police Commissioner Richard Ross identified the gunman Saturday as 25-year-old Nicholas Glenn, of West Philadelphia.

The shooting rampage started about 11:18 p.m. when Glenn walked up to a marked police cruiser at 52nd and Sansom Streets and just began firing, police said.

Sgt. Sylvia Young, 46, who was sitting inside the car, was shot several times after Glenn fired off 18 shots, Ross said at a Saturday afternoon news conference. Her gun was hit as well. A 19-year veteran assigned to North Philadelphia's 22d Police District, Young on Friday was working with a task force in West Philadelphia.

She and another officer, who was later shot - University of Pennsylvania officer Eddie Miller, 56, a former Philadelphia police sergeant who joined Penn's force two years ago - were both in stable condition Saturday at Penn Presbyterian Medical Center.

One of the four civilians who was shot, Sara Salih, 25, who was sitting in a car at 49th and Sansom Streets, near where she lived, died. She was shot seven times in her torso and was pronounced dead at Penn Presbyterian at 1:56 a.m. Saturday.

The three other civilians who were shot - a 36-year-old man shot twice in his left arm and once in his right arm; a 42-year-old man shot twice in his left leg; and a 41-year-old woman shot once in her right ankle - were all in stable condition at Penn Presbyterian Saturday afternoon, police said.

"A horrific night," Ross said.

After shooting the sergeant, then attempting to flee, Glenn shot a security guard and a patron at a bar. He then fired 14 times at a man and a woman inside a vehicle, killing the woman, Ross said. The man in the vehicle was initially listed in critical condition; police Saturday afternoon said his condition was stable.

In the hours after the shootings, police flooded the area looking for possible accomplices, but after a couple hours determined that the shooter had acted alone.

"We believe this is isolated to this individual," Ross said while briefing reporters early Saturday morning outside Penn Presbyterian.

What was left to do was figure out what happened and why it happened.

Glenn was carrying a white, sealed envelope that read "Doomed People" on it, Ross said.

The commissioner said police found a "rambling" letter allegedly written by the gunman in which he expressed hatred toward police and probation officers. He said there was no reason to believe at this point that the gunman had any religious beliefs that drove him to the shootings. 

Other than his "rantings in that letter," Ross said Glenn's motive was unclear. "We may never know."

Employees at the Central City Toyota dealership, whose back end faces Sansom Street, said on Saturday that Glenn had ducked underneath a partially opened garage door there to hide from police at one point during the rampage.

The dealership's cleaning crew, the only people in the building at the time, spotted him hiding among the tires, the employees said. Glenn apparently did not see them. He then fled out a back door. 

Police would later corner him in an alley a few yards down the block. 

Ross said Glenn "has a pretty significant past" and was well known to police.

According to court records, Glenn had a history of drug-possession convictions in Philadelphia. He had also been arrested and charged in connection with a gang-related rape in a November 2009 incident, but these charges were later dropped. 

On the night of Nov. 19, 2009, a 24-year-old woman had allegedly been accosted by six men near 56th and Walnut Streets after she had gone out to get takeout food. She was allegedly forced into a nearby apartment building and raped. The woman had been treated and released at Episcopal Hospital.

Court records show prosecutors dropped charges against Glenn in the rape case in December 2011. It was not clear why. Lawyers who had been involved in the case did not return calls for comment Saturday. A person who previously knew Glenn, Deedee Griffin, 22, of North Philadelphia, contended charges were dropped because there was evidence that the victim was not forced into the encounter.

Police gave this account of what happened Friday night:

At 11:18 p.m., Sgt. Young was in a marked police cruiser at 52nd and Sansom Streets when the gunman approached. He started firing.

"She didn't hear him say a word," Ross said, who added that the gunman did not know her.

Young, trapped in the vehicle, couldn't do anything but lean over into the passenger side until the firing stopped, Ross said.

She heard at least 15 shots. She was struck in her left arm and in her protective vest.

Other officers, seeing that Young had been shot, started chasing the suspect east on Sansom.

On Sansom Street, near 51st, he fired into a bar, the Maximum Level Lounge, wounding a security guard. Then, he grabbed a woman and "uses her as a shield," Ross said.

Then the suspect shot her in the leg and resumed running east on Sansom.

At 49th and Sansom, he came across a white vehicle and fired multiple times into it, striking a man and the 25-year-old woman in the torso seven times. The woman died.

In a north-south alley at 48th and Sansom, the Penn police officer followed by two Philadelphia police officers confronted the gunman, and fired, killing the suspect, Ross said. The Penn officer, shot in his right ankle and right pelvis area, was wounded in that action.

Police on Saturday said two officers fired at Glenn, but did not identify those officers. Glenn was pronounced dead at the scene by medics at 11:47 p.m. Friday.

Glenn's 9mm Ruger, which had an obliterated serial number, was recovered, Ross said. Glenn, who had no ID on him, also had three gun magazines and 15 loose bullets in a bag, the commissioner said.

"We know he was hell-bent" on hurting a lot of people, Ross said.

"If an individual can harm a law-enforcement officer they can harm just about anybody, and that's what he did," the commissioner said.

Early Saturday morning, Mayor Kenney said he visited the officers and said both were alert and talking.

Miller, the Penn officer, was cracking jokes, the mayor added.

"All in all, it was a terrible scary night," Kenney said.

The mayor said he wanted to thank all police officers for their service and remind them to wear their vests.

Effective immediately, officers will be patrolling in pairs, Ross said.

As word came out on the shootings, local and national figures began tweeting on it, including Philadelphia District Attorney Seth Williams, who wrote: "Please keep the @PhillyPolice SGT, @PennDPS P/O shot tonight their families, friends & co-workers in your prayers as they deal w/ trauma."

Republican presidential candidate Donald Trump tweeted:

"My thoughts and prayers go out to the @PhillyPolice & @Penn police officers - in Philadelphia."

In a statement Saturday, Pennsylvania Gov. Tom Wolf thanked law-enforcement officers and said in part: "Our thoughts are with the officers and other victims of this horrifying violence."

University of Pennsylvania President Amy Gutmann said in a statement that she was able to see Officer Miller at Penn Presbyterian Saturday morning. She said she was "so relieved and pleased to report that he is getting excellent care and will fully recover from his wounds." She thanked Miller, Sgt. Young and other officers for their bravery.

"In these challenging and difficult times for our country, there is no place that is immune to such senseless outbursts of violence," she said. She said the Penn community's thoughts and prayers are with the victims and their families.

The ambush on the police sergeant was reminiscent of the Jan. 7 nighttime shooting when a gunman walked up to a patrol car at 60th and Spruce Streets in West Philadelphia and without warning, shot and seriously injured Philadelphia Police Officer Jesse Hartnett, now 34.

The alleged gunman in Hartnett's shooting, Edward Archer, now 31, of Yeadon, later confessed to police that he had carried out the shooting "in the name of Islam" and said he had sworn allegiance to ISIS, authorities have said.Archer, in custody, faces trial on attempted murder and related charges.

215-854-2592 @julieshawphilly