The barricaded gunman shot six officers during the nearly eight-hour standoff.
Two officers and three civilians were trapped inside the home with the active shooter for hours before SWAT was able to safely extricate them.
Hundreds of bystanders lined the streets as volleys of gunshots rang out, KYW reported.
“A major moment of disappointment this evening was watching a crowd of people taunt police officers, laughing and yelling at them in the midst of the gunfire,” KYW reporter Alexandria Hoff tweeted on Wednesday night.
“I should add - 98% of people here on scene were respectful and concerned,” Hoff noted. “That moment was just such a startling thing to see in the middle of something so chaotic.”
One video showed a line of silent, solemn officers as the wove their way through a rowdy crowd.
At one point, a woman shoved one of the officers from behind as he was walking past her. Others threw objects at police.
“B---h -ss n----as!” one onlooker shouted.
The crowd followed the officers as they walked down the block and lined up on near the crime scene tape.
As police faced the hecklers, the crowd became even more irate, the video showed.
One irate man in a black t-shirt squared off with officers and waved his arms aggressively just feet away from them.
The 36-year-old gunman’s attack began at approximately 4:30 p.m. on Wednesday, when police attempted to serve a narcotics warrant at a residence in the 3700-block of North 15th Street, The Washington Post reported.
The situation “went awry almost immediately,” Philadelphia Police Commissioner Richard Ross said, according to The Washington Post.
As soon as the officers got into the home, they were met by a barrage of bullets that forced them to return fire, KYW reported.
Officers dove through windows and out doorways to escape, but two of the officers remained trapped inside the home with the gunman.
The attacker continued to fire on police as they surrounded the outside of the building, and shot more officers.
Residents hid inside their homes and dove behind vehicles to shield themselves from the gunfire, The Washington Post reported.
Dramatic news helicopter footage showed an officer pouring blood on the street while running to a patrol car to be transported to the hospital, KYW reported.
A short while later, another wounded officer was seen being helped to run from the scene and then was also placed into a patrol car and transported away, according to WPVI.
Other officers crouched behind vehicles and exchanged gunfire with the attacker.
Approximately 80 children and infants were evacuated from daycare centers located just two blocks away from the standoff, The Washington Post reported.
During the gunfight, the suspect started live-streaming on social media, according to KYW. Authorities were able to work with the social media company to take the stream down.
“It was like a war — like a scene that you see in war,” one resident said, according to The Washington Post. “The guns, the fire, the noise — it was like bombs going off simultaneously at a time where people are having dinner.”
The officers trapped in the apartment had been pinned down for about five hours by the time SWAT was able to extricate them.
Three citizens were also rescued during the extrication, CNN reported.
“They kept us safe the whole time,” one of the women who was rescued said through tears. “The whole time, they kept us safe.”
Commissioner Ross said that he does not believe the shooter realized that SWAT was conducting the rescue mission due to the level of stealth the team used.
Meanwhile, the six officers with gunshot wounds were transported to Einstein Medical Center and Temple University Hospital, according to KYW.
Commissioner Ross said they were treated for their wounds and have all been released from the hospital, according to The Washington Post.
A seventh officer was injured in a collision while responding to the active shooter situation.
He remains hospitalized, but is in stable condition, KYW reported.
No citizens were hurt during the incident.
Towards the end of the standoff, police allowed the attacker’s attorney, Shaka Johnson, to come to the scene to speak with him, The Washington Post reported.
Commissioner Ross acknowledged that using the attorney in an effort to end the situation was “unorthodox.”
“But again, it was a very unusual circumstance,” the commissioner added. “This was a very dynamic situation, one that I hope we never see again.”
According to Johnson, the shooter has a history of weapons-related convictions, The Washington Post.
Police equipped Johnson with body armor and approached the residence with him, according to NBC News.
"I could sense that he was panicking and trying to figure out, how do I get out of this situation alive," the attorney later explained. "I just kept the conversation as light-hearted as it could be under the circumstances, and when appropriate I switched back to, ‘you’ve got to come out, man, and you have to put your phone down, you can’t come out with any weapons, you’ve got to put your hands up.’”
Shortly after midnight on Thursday, the gunman walked out with his hands raised after officers fired tear gas into the home, bringing the eight-hour standoff to an end, The Washington Post reported.
“It's nothing short of a miracle that we don’t have multiple officers killed today," Commissioner Ross said, according to NBC News.
Pennsylvania Governor Tom Wolf said he was “deeply troubled” to learn about the mass shooting of law enforcement officers.
"Tonight is another reminder of the selfless sacrifice of our law enforcement officers and first responders,” Wolf said. “We are praying for a peaceful resolution and the full recovery of all those injured.”
You can watch cell phone footage of the officers’ encounter with the unruly crowd in the video below: