(CNN) A man who opened fire on officers attempting to serve a warrant in North Philadelphia was taken into custody early Thursday after a standoff that left six officers wounded, police said.

Two officers and three other people who had been trapped inside the row house were evacuated by a SWAT team a few hours before the standoff ended.

Here's what we know:

How it started

The shooting began when authorities attempted to serve a warrant at about 4:30 p.m. Wednesday in the Nicetown-Tioga neighborhood, Philadelphia Police Commissioner Richard Ross Jr. said Wednesday night.

"This was a narcotics warrant that went awry almost immediately," Ross said.

Officers became trapped in different parts of the house when the shooting began, Ross said. That's how two officers and three others got trapped in the house.

All five were evacuated by SWAT officers after nightfall, Ross said.

The standoff lasted nearly eight hours before the suspect surrendered.

The suspect

Ross identified the suspect as Maurice Hill.

The gunman fired intermittently at police -- sometimes shooting out of a window -- during the standoff, Ross said.

Negotiators tried to communicate with the shooter, but he kept picking up the phone without responding, the police chief said.

After hours of ignoring efforts by police to communicate, the man's attorney and Ross got on a call with him to try to assure him police were not going to harm him.

Police eventually used tear gas , and man was taken into custody around midnight, police said.

"I am surprised that he came out," Ross said. He said the suspect told him on the phone during the standoff that he had an "extensive" criminal history.

A police officer patrols the block near the shooting scene in Philadelphia on Wednesday.

The wounded officers

Six police officers were shot during the incident, the police commissioner said.

A bullet grazed one officer's head, Ross said. But none of the officers had life-threatening injuries, and all six officers who were shot have been released from area hospitals, police said.

One other officer sustained injuries in a vehicle crash related to the incident.

Mayor Jim Kenney said he spoke with the wounded officers.

"I had the opportunity to speak to the six officers, they're all in good spirits and obviously it was a very traumatic experience for them," he said. "I was talking to one of the officers who had the graze wound to the head and he had two little boys -- they looked like they were 9 or 10 years old, 8 or 9 years old -- and kept on thinking about how their lives would have changed with just a little more difference in space."

Police officers escort a bystander away from the scene of the shooting in Philadelphia on Wednesday.

How people are reacting

"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."

Ross said the suspect was armed with a gun when he was arrested.

Hill 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.

Philadelphia's mayor called for more gun control, saying the city's police officers need help keeping weapons out of the hands of criminals.

"And if the state and federal government don't want to stand up to the NRA and some other folks, then let us, let us police ourselves. But they preempt us on all kinds of gun control legislation," Kenney said.

"Our officers deserve to be protected and don't deserve to be shot at by a guy for hours with an unlimited supply of weapons and an unlimited supply of bullets."

Pennsylvania Gov. Tom Wolf tweeted support of law enforcement and called for action on gun violence.

"Tonight is another reminder of the selfless sacrifice of law enforcement and first responders," Wolf said on Twitter. "We must remain committed to combatting violence and getting dangerous weapons out of our communities."

President Donald Trump has been briefed on the shooting and is monitoring the situation, the White House said..

Democratic presidential contenders also were monitoring the shooting.

In a tweet, former Vice President Joe Biden said he and his wife "send our prayers to the police officers injured today in Philadelphia, and to their families who wake up every day knowing their loved ones are walking into harm's way when they put on a badge."

Beto O'Rourke said the shooting was "a reminder of what police officers across America risk to serve their communities each day."

"Thinking of Philadelphia, and everyone impacted by this gun violence epidemic we need to end," he tweeted.