The suspect has been taken into police custody after an hourslong standoff with the police in Philadelphia.

Before he surrendered and came out, police surrounded the row house and cordoned off the nearby streets.

Police officers gather near the scene of a shooting on August 14, 2019 in Philadelphia, Pennsylvania. Mark Makela/Getty Images

Onlookers gathered as police tried to get the suspect to communicate. Six officers were injured, but they have been released from the hospital and are in "good spirits," said the Philadelphia mayor.

Onlookers gather near the scene of a shooting on August 14, 2019 in Philadelphia. Mark Makela/Getty Images

SWAT and police teams were deployed. The SWAT teams helped evacuate two police officers and four women who had been trapped inside the home.