(CNN) A man accused of shooting six Philadelphia police officers and prompting an hourslong standoff Wednesday shouldn't have had a gun, the city's top prosecutor said.

"I think it's clear this man should not have been on the streets," Philadelphia District Attorney Larry Krasner said Thursday.

"He was a felon before he was handling this weapon."

Investigators retrieved the alleged gunman's AR-15 Thursday from the row house where the suspect was barricaded, according to CNN affiliate KYW . Police say it is the same model the gunman shot in the standoff.

Authorities say Maurice Hill, 36, shot and wounded six officers after police attempted to serve a narcotics warrant on the row house Wednesday afternoon.

The Philadelphia shooting suspect surrendered early Thursday.

As they got toward the kitchen area, a gunman fired multiple rounds, forcing some officers to escape through the window, authorities said.

Others, including two officers, initially were trapped in the house with the gunman, prompting a SWAT team rescue.

As the shooter shot at police outside, bullets ricocheted on the pavement, sending officers crouching behind police cars.

The suspect surrendered outside almost eight hours after the standoff began.

"We do know this guy came actually outside with a gun ... so this could have been even more dangerous and volatile if not for the professionalism of SWAT" officers, Philadelphia Police Commissioner Richard Ross said.

Mayor Jim Kenney said he's thankful no lives were lost, but is "a little angry about someone having all that weaponry and all that firepower."

"But we'll get to that another day," the mayor said. "It's about the officers and their families right now."

The six officers shot have been released from a hospital, police said.

The suspect has a 12-page criminal record with charges including burglary, aggravated assault and taunting a police animal. But only a minority of the charges resulted in convictions, such as one for aggravated assault.

At least two weapons were used in the shooting, said Don Robinson, the Bureau of Alcohol, Tobacco, Firearms and Explosives special agent in charge in Philadelphia.

The ATF has not recovered guns in the house for tracing because of lingering tear gas.

US Attorney Bill McSwain brought up the issue of federal charges against Hill.

"We have a lot of options but it depends on the evidence that is taken from the house," he said. "Depending on whether there are drugs in there, could affect potential federal charges, depending on what kinds of weapons are in there."

McSwain opened a news conference by reading a statement in which he lambasted the district attorney, a Democrat who took the position in January 2018.

"There is a new culture of disrespect for law enforcement in this city that unfortunately promoted and championed by District Attorney Larry Krasner and I am fed up with it," McSwain said. " ... and now we've endured for a year and half the worst kind of slander against law enforcement, with the DA routinely calling police and prosecutors corrupt and racist, and most recently comparing them to war criminals and comparing them to Nazis."

McSwain became the US attorney for the Eastern District of Pennsylvania after being nominated by President Donald Trump in 2018.

'We've got a pretty horrible situation unfolding'

Police officers watch as a gunman is apprehended following a standoff Wednesday night.

The shooting started about 4:30 p.m. after officers entered the home. More than three hours after the first shots, the suspect showed no signs of surrendering, police said.

Concern grew for two officers trapped in the house with the gunman as police cars and officers in tactical gear swarmed the neighborhood.

"We've got a pretty horrible situation unfolding, and you hear me say unfolding because it is not resolved," the police chief said at the time.

Negotiators tried to communicate with the suspect, but initially he was picking up the phone and not responding, Ross said.

At one point during the standoff, the suspect spoke with his girlfriend via video chat, the police commissioner said.

Ross did not detail how officers learned about the chat between Hill and his girlfriend.

"I do know there was a point when we know he was FaceTiming his girlfriend, and that's how we ended up with the information about her and largely about his newborn, which obviously we're leveraging that to try to appeal to him and his sense of reasoning."

Officers used 'stealth' to rescue officers and others trapped in home

As the sun set and the standoff dragged on, the mayor said he was listening to police radio transmissions. Officers in the house were whispering because they didn't want the shooter to hear them, he said.

Five hours after the standoff started, a SWAT team rescued two officers and three others trapped inside the row house, the police commissioner said. CNN affiliate KYW reported the officers were trapped on the second floor while the shooter was on the first floor.

"They were able to use stealth to do it," the mayor said. He said the shooter appeared unaware of the rescue mission.

The suspect called an attorney for help during the standoff

Eventually, the suspect talked by phone to an attorney, who tried to convince Hill to surrender peacefully, the police commissioner said.

"I gave his attorney, Shaka Johnson, a lot of credit that he came and he was able to certainly engage him in conversation much longer," Ross said.

Johnson told CNN affiliate KYW that he is Hill's former attorney, and that he received a call from Hill at about 8:30 p.m. Wednesday while he was watching the drama unfold on TV.

Johnson said the suspect told him he needed help.

"I realized who it was. The game for me became getting him out of there safely," Johnson told KYW.

"He did not want this to end violently. ... I told him you got to surrender now."

Authorities had to use tear gas to get the suspect out of the house, the police chief said. And because tear gas was still wafting in the air Thursday morning, investigators haven't been able to go inside the home.

"It will be active scene for a number of hours," Ross said.

'It's disgusting' how many bullets and weapons the suspect has

Shortly after midnight, police announced the suspect had been arrested.

"I am surprised that he came out," the police chief said. He said the suspect told him on the phone during the standoff that he had an "extensive" criminal history, but the chief would not comment on specifics about his criminal background.

Ross said the suspect had "some kind of .380" weapon on him when he was arrested.

The Philadelphia mayor called out the National Rifle Association and demanded a resolution to the nation's gun crisis, saying officers need help keeping guns out of criminals' hands.

"Our officers deserve to be protected and they don't deserve to be shot at by a guy for hours with an unlimited supply of weapons and an unlimited supply of bullets. It's disgusting and we got to do something about it ... quickly," the mayor said.

"This government, both on federal and state level, don't want to do anything about getting these guns off the streets and getting them out of the hands of criminals."