He has been identified as Thomas Siderio Jr.
Authorities said four South Task Force officers were conducting surveillance inside an unmarked vehicle as part of a firearms investigation in the area of 18th and Johnston streets around 7:24 p.m.
Police say the officers spotted two males at 18th and Barbara, one of whom was wanted for questioning in connection with questionable social media posts about a stolen gun.
The officers drove toward the two males, stopped a few feet away, then activated the red and blue emergency lights on their unmarked vehicle, police say.
According to police, that's when the officers heard gunfire and the sound of glass shattering from the rear passenger window.
One of the officers was hit by shards of glass in his face and eyes. Police say the bullet went through the rear passenger window's glass, hit the inner doorframe, then went through the passenger's headrest before stopping in the vehicle's headliner.
Two of the officers got out of the vehicle and fired at Siderio, who police say was still in possession of his gun.
Police say one of those officers fired twice, hitting Siderio in his upper right back, with the bullet exiting from his left chest.
He was rushed to the hospital and pronounced dead at 7:29 p.m.
The shooting was captured on a doorbell camera near 18th and Barbara. You hear one initial gunshot and then four more.
Police say the gun in Siderio's possession, a 9MM equipped with a laser, had been reported stolen. The gun was recovered at the scene and was found to have one round in the chamber and five in the magazine, police say.
Another male, a 17-year-old who was wanted for questioning in relation to the firearms investigation, was detained by police but released pending further investigation.
The teen's stepfather told Action News that he was at the wrong place at the wrong time.
"What I heard was when the cops pulled up in an unmarked car, they thought someone was jumping them because they slammed on the brakes. So the kid shot because he thought somebody was going to shoot him," said the teen's stepfather, Salman Khan.
Our sister station, 6abc Action News, obtained video showing the officers pacing back and forth while they waited for an ambulance.
Neighbors say Siderio was a troubled kid. He was reported missing when he was 11 years old but was found two days later.
The officers involved in the shooting have been placed on administrative duty pending the outcome of the investigation.
Philadelphia Police Commissioner Danielle Outlaw issued a statement that reads:
"Last night, a young child with a gun in their hand purposely fired a weapon at our officers and by miracle, none of the officers suffered life threatening injuries.
However, the life of a young man was cut tragically short, and we should all be questioning how we as a society have failed him and so many other young people like him.
I ask that our community come together and be the community-the village-that we were intended to be and that our children need.
I assure the public that a fair and thorough investigation will be conducted by our Internal Affairs Division.
Per protocol, these officers have been placed on administrative duty pending the outcome of the investigation."