Snipers shot dead five police officers and injured six others in Dallas, unleashing chaos during a protest against police shootings of black men in an ongoing standoff Friday.
Police had the city on lockdown after a suspect warned that bombs had been planted throughout the city center.
The shootings, which the police called a "terrorist incident", took place as several hundred people marched through the Texan city to protest the fatal shootings this week of two black men by police in Louisiana and Minnesota.
As the rally was winding up, shots rang out around 9:00 pm (0200 GMT Friday), causing panic among the protesters, who scrambled to take cover.
City police chief David Brown said two snipers shot at the police "from elevated positions during the protest/rally". A civilian was also wounded.
Police continued to trade fire with a suspect into the early hours of Friday at a downtown garage.
The suspect "has told our negotiators that the end is coming, and he is going to hurt and kill more of us, meaning law enforcement. And that there are bombs all over the place in this garage and in downtown," Brown told reporters.
Three others suspects were taken into custody -- one woman and two men found with camouflage bags in a car.
"We still don't have a complete comfort level that we have all the suspects," Brown warned.
Another man turned himself into the police after the authorities tweeted a picture of him wearing camouflage and an assault rifle slung across his shoulder, with a call for information on his whereabouts.
It is legal for those with permits to openly carry weapons in the state of Texas. The man, named as Mark Hughes, was later released.
The shootings, which looked set to further strain race relations in the US, stunned the country.
One witness at the rally spoke of "complete pandemonium."
"There was blacks, whites, latinos, everybody. There was a mixed community here protesting. And this just came out of nowhere," Cory Hughes, a brother of the man who turned himself in and was cleared, told CNN.
"I'm still kind of startled, shaken up. As you know being in the front, it's almost like the gunshots were coming at us. It was complete pandemonium... It's bananas."
The protest was one of several nationwide over the fatal police shootings of black men in Minnesota and Louisiana this week that have prompted President Barack Obama to make an emotional appeal for urgent police reform.
The Federal Aviation Administration restricted use of the airspace over the city center until 1130 GMT, saying "only relief aircraft operations under direction of Dallas Police Department are authorized."
Rail and bus links were suspended in the downtown area of the usually bustling Texas city.
The White House said Obama has been updated on the shooting. The president, who is traveling in Europe for a NATO summit, was expected to make a statement on the situation.
Mayor Mike Rawlings spoke of a "heartbreaking morning" for the city.
"We as a city, we as a country, must come together, lock arms and heal the wounds that we all feel from time to time. Words matter. Leadership matters at this time," he said.
Brown initially said two of the injured officers were undergoing surgery and three were in critical condition. The condition of the other officers was unclear.
Among the officers killed was Dallas Area Rapid Transit officer Brent Thompson, 43, the agency said, adding he was the first DART officer killed in the line of duty.
Dramatic video of the shooting emerged from witnesses, who posted the footage online. Bursts of gunfire and police sirens could be heard in the videos.
Ismael DeJesus, who filmed the attack while hiding in the Crown Plaza Hotel, described to CNN how one of the gunmen shot an officer on the ground.
"It looked like an execution, honestly. He stood over him after he was already down. Shot him maybe three or four more times in the back."
In another video, posted by Twitter user @allisongriz, one witness can be heard saying: "Oh, my God. There are people laying on the ground. I hope they're just hiding."
Words of support and concern came pouring in for the police.
"As this situation continues to unfold, I'm praying for the brave men and women of the @DallasPD and those in downtown Dallas," Republican Congressman Pete Sessions said on Twitter.
Criticism of the civil rights movement Black Lives Matter behind the protests held Thursday in several cities was also swift.
"This is now war. Watch out Obama. Watch out black lives matter punks. Real America is coming after you," former Republican congressman Joe Walsh wrote in a tweet that was later deleted after he came under heavy criticism for his comments.
The deaths of Alton Sterling in Louisiana and Philando Castile in Minnesota have reignited a debate about the police's use of lethal force against suspects, especially against blacks.
Obama, America's first black president, said it was clear the shootings were not "isolated incidents."
Castile's girlfriend Diamond Reynolds livestreamed the aftermath of Wednesday night's shooting in a Saint Paul suburb, where an officer fired at Castile after pulling him over, reportedly for a broken tail light.
The 10-minute video -- which shows a dying Castile bleeding profusely -- has been viewed millions of times after it was posted on Facebook.
Thousands marched in protest in Los Angeles, Chicago, Washington, Dallas, Atlanta and other cities Thursday evening, with more than 1,000 protesters gathering in New York's Time Square.