PHILADELPHIA — Just after midnight, a suspect surrendered after shooting six police officers in a north Philadelphia neighborhood on Wednesday evening, Aug. 14, igniting a standoff that dragged on for hours in what authorities called a hostage situation.

The suspect is Maurice Hill, a 36-year-old Philadelphia resident with a history of gun convictions, his former lawyer told The Washington Post. Philadelphia Police Sgt. Eric Gripp confirmed on Twitter early Thursday that the suspect is in custody.

The suspect walked out of the house with his arms raised in the air as local TV crews filmed the scene.

Gunfire first broke out around 4:30 p.m., said Philadelphia Police Commissioner Richard Ross, after officers attempted to serve a narcotics warrant "that went awry almost immediately." Once they were inside the home, a barrage of bullets forced officers to return fire and retreat through windows and doors.

More than three hours after the first shots rang out, police were still locked in a dangerous standoff with at least one gunman barricaded inside the home, trading shots with officers outside. Residents, forced to dive behind cars and hide in their homes, described the scene like a war zone: Bullets flew through the streets and wafts of gunpowder filled the air.

More national news:

As the sun set, Ross said at a news conference he was concerned about two officers in the house with the gunman. They were there for hours until a SWAT team evacuated them, but, he said, the gunman remained inside with no intention of surrendering.

"We've got a pretty horrible situation unfolding - and you hear me say unfolding because it is not resolved," Ross said.

Alisha Bogan, who lives around the corner from where the standoff took place, said she was on her way home to her daughter and mother when she heard gunshots.

"There were a whole lot of people running," Bogan told The Washington Post. As the gunfire continued, she took cover under a car. Then, she tried to get to her house and her family, but couldn't get past the police caution tape. Dozens of frustrated residents faced the same dilemma, unable to get to their homes. They gathered on the sidewalks and streets late Wednesday night as storms passed through the region.

After the two officers made it out of the house, Ross told reporters, "We've gone from a hostage situation to a barricade." He said police were still trying to talk the shooter into surrendering. Late Wednesday night, the suspect was still inside.

Dramatic live footage from media helicopters showed scores of officers swarming the house in the residential Nicetown - Tioga neighborhood. They crouched behind cars and exchanged fire with someone inside the house.

On the ground, television reporters' microphones picked up sounds of gunshots. Multiple officers were seen being carried into police vehicles and transported away from the scene.

A bullet grazed one of the officers' heads, Ross told reporters. Others were shot in the arm and elsewhere, he said.

"Nothing short of astounding that in such of a confined space we didn't have more of a tragedy than we did," Ross said.

They were released from hospitals later that night, but another officer was still being treated for injuries sustained in a car crash related to the incident.

Philadelphia Mayor Jim Kenney, D, said the wounded officers were "all in good spirits."

"We're thankful - a little angry about someone having all that weaponry and all that firepower - but we'll get to that another day," he said at the news conference. "It's about the officers and their families right now."

Soon after the melee began, more than 30 police vehicles swarmed the intersection of North Broad Street and West Erie Avenue, a semi-residential area, with homes and apartment buildings alongside temples and coffee shops.

Two day cares - Shake, Rattle and Roll Learning Center and Precious Babies Learning Academy - are located about two blocks from the nexus of the shooting. Daycare employees and police evacuated approximately 80 children and babies to a secure location to be reunited with family.

In a statement, the White House said President Donald Trump had been briefed on the shooting and was monitoring the situation. Pennsylvania Gov. Tom Wolf, D, said he was doing the same, and offered state support to local law enforcement.

Temple issued a lockdown for its Health Sciences Center Campus and advised anyone there to "Seek shelter. Secure doors. Be silent. Be still." The university lifted the lockdown two hours later, but advised students, faculty and staff to steer clear of the crime scene.

Omar Caid, a student at the school, said he got an email from Temple telling him to take cover. At first, he said, he wasn't worried - he's seen shootings in his community before.

"I thought it was a normal shooting - this isn't the best neighborhood, but it isn't the worst," he said. "I thought it was gang-related, then I heard it was three officers and knew this was different."

In interviews with other local TV outlets, residents, crowding the streets behind police barricades, described the frightening, chaotic scene punctuated by repeated volleys of gunfire.

"It was like a war - like a scene that you see in war," a woman who lives in the neighborhood told NBC. "The guns, the fire, the noise - it was like bombs going off simultaneously at a time where people are having dinner."

This article was written by Maura Ewing, Reis Thebault, Timothy Bella and Michael Brice-Saddler, reporters for The Washington Post.