Cops said officers shot the unidentified 30-year-old man multiple times at about 6:15 p.m. when he allegedly pointed the weapon at one of them.
So many shots were fired in the deadly confrontation that crime-lab investigators had to use hand-written markers to locate each spent shell.
More than 107 placards marked the trail of spent police ammunition along Tasker Street between Baily and Taney streets, police said.
The gunman did not fire, police said. He was pronounced dead at the Hospital of the University of Pennsylvania.
Two cops were treated at HUP and released after suffering minor injuries caused by friendly fire.
It was unclear how many cops fired their weapons. The Internal Affairs Division is investigating, as is routine when officers fire their weapons.
The drama unfolded as numerous residents of the normally tranquil neighborhood were on the street and had to bolt for cover.
"Officers repeatedly ordered the man to drop his weapon and he did not comply," said police spokesman Capt. Benjamin Naish. "At one point during the confrontation, the man raised his gun and pointed it towards one of the officers.
"The officer, fearing for his safety, discharged his service weapon, and additional officers fired at the man and he was struck multiple times."
Michael Costello, one of the homicide investigators on the scene, said police recovered a fully loaded "large caliber" weapon that the suspect apparently brandished.
Neighbors were frightened both by the man and by the use of force by the cops.
"I saw [the situation] right before the firing started," said resident Jalen Miles. "I then saw cops aiming at him, and I said, 'They are about to kill him,' and that's when my mom said for me to go into the house.
"I heard 90 or more shots."
Miles was able to capture some grainy video with his cell phone, which showed cops moving into position with their guns drawn.
"He looked crazy," said Leslie Blackwood. "He looked totally out if it, like he wasn't all there. I seen him walking with a gun. It was someone I never seen before."
One unidentified neighbor thought the cops exceeded the force necessary.
"Oh my God, all those shots," the neighbor exclaimed. "What did the cops have, Uzis?"
Another neighbor said he heard the shooting blocks away, at 23rd and Tasker.
As residents spoke with reporters, Costello voiced the frustration the department feels when dealing with less-than-cooperative witnesses.
"We have a lot of resources and evidence to process," Costello said. "But regardless of what you are hearing, no one is giving any information, and no one has seen anything." *
Staff writer Christine Olley contributed to this report.