A suspect has been taken into custody after injuring six officers in a shootout in the US city of Philadelphia.
A gun battle broke out between police and a male shooter at about 16:30 local time (20:30 GMT).
The officers were serving a drugs warrant at a home in Philadelphia’s Nicetown-Tiago neighbourhood when the gunman opened fire.
A seven-hour stand-off ensued as police urged the gunman to surrender.
A video on social media purportedly shows the suspect, named by US media as 36-year-old Maurice Hill, leaving the house with his hands in the air.
The suspect’s lawyer Shaka Johnson told CBS3 he helped police negotiate the surrender.
A Swat team rescued two officers and three civilians who were trapped inside the home with the gunman, police said.
Police Commissioner Richard Ross said the Swat team “were able to use stealth” to safely evacuate the officers from a “hostage situation”.
Mr Ross said the trapped officers were holding people they arrested during a raid “that went awry almost immediately”.
The gunman fired on the Swat team’s truck outside the home, where police wearing bulletproof vests took cover behind cars with guns drawn.
The suspect was reportedly armed with a semi-automatic rifle and several handguns.
At one point, he was said to have been livestreaming the incident on Facebook, according to local media reports.
During the stand-off, officers attempted to “communicate with the shooter” and urged him to give himself up, police Sergeant Eric Gripp tweeted.
Negotiators attempted to call the suspect’s phone and were working with a family member and his lawyer.
Six officers who sustained non-life threatening injuries in the shooting have been released from hospital.
Mr Ross said “many of them had to escape through windows and doors” as the suspect fired.
“It’s nothing short of a miracle that we don’t have multiple officers killed today,” the commissioner said.
A seventh officer, who was injured in a car crash while responding to the shooting, remains in the hospital.
A witness told local media she heard more than 100 gunshots and people running for their lives. “They kept us safe the whole time, the whole time, they kept us safe,” one woman said of the officers.
Video from the scene shows dozens of police cars and officers outside the home where the gunman was hunkering down.
US President Donald Trump was briefed on the shooting, deputy White House press secretary Hogan Gidley said.
The incident comes after two mass shootings – in El Paso, Texas and Dayton, Ohio – brought the debate about gun control in the US into sharp focus.