The alleged gunman who wounded six Philadelphia police officers during an hours-long firefight has been taken into custody, authorities said early Thursday morning.

Philadelphia police Sgt. Eric Gripp said that the man was taken into custody and that SWAT personnel are still clearing the house in which the gunman had barricaded himself.

ADVERTISEMENT

Gripp also said late Wednesday night that all six officers who suffered gunshot wounds had been discharged from local hospitals and that two additional police officers who were reportedly trapped inside a home with the suspected gunman had been “safely evacuated.”

An additional officer who was admitted to a hospital for injuries from a vehicle crash related to the incident was still being treated as of Wednesday night.

The shootout began late Wednesday afternoon when officers were trying to serve a warrant.

Philadelphia Police Commissioner Richard Ross said in a statement that many officers “had to escape through windows and doors to get [away] from a barrage of bullets” and that “It’s nothing short of a miracle that we don’t have multiple officers killed today,” according to The Associated Press.

Police had pleaded with the gunman to surrender during the standoff, at one point reportedly patching in his lawyer on the phone with him to try to convince him to put down his weapons.

“We’re doing everything within our power to get him to come out,” Ross said during the standoff. “He has the highest assurance he’s not going to be harmed when he comes out.”