Snipers operating from rooftops in Dallas killed five police officers and wounded six more in a coordinated attack during one of several protests across the country against the killing of two black men by police this week.
Police described Thursday night's ambush as carefully planned and executed and had taken three people into custody before a fourth died from what Dallas-based media said was a self-inflicted gunshot after a standoff that extended into Friday morning.
The fourth suspect had exchanged gunfire with police during the standoff at a downtown garage and warned of placing bombs throughout the city. Police have yet to confirm his death.
The attack was one of the worst mass shootings of police in the US history.
White House officials have spoken with Dallas Mayor Mike Rawlings about the shooting that turned the downtown of one of the largest US cities into a sprawling crime scene, unfolding along streets that house major corporations, restaurants and government offices.
A spokesman said President Barack Obama, visiting Poland, has been briefed about the sniper shootings that took place as a protest in Dallas was winding up under the watch of the police.
No specific motive has been given for the shootings at the downtown protest, one of many held in major cities across the United States on Thursday. New York police made more than a dozen arrests on Thursday night, while protesters briefly shut down one of Chicago's main arteries.
Dallas Police Chief David Brown said the shooters, some in elevated positions, used sniper rifles to fire at the officers in what appeared to be a coordinated attack.
"(They were) working together with rifles, triangulating at elevated positions in different points in the downtown area where the march ended up going," Brown told a news conference, adding a civilian was also wounded.
"It has been a devastating night. We are sad to report a fifth officer has died," Dallas police said on Twitter.
Mayor Rawlings advised people to stay away on Friday morning as police combed the area where large areas have been cordoned off and transport halted. Federal authorities also halted commercial air traffic for the area as police helicopters hovered over the scene.
"Our worst nightmare has happened," the mayor said. "It is a heartbreaking moment for the city of Dallas."
The Dallas-Fort Worth metropolitan area is one of the nation's most populous and is home to more than 7 million people.
The use of force by police against African-Americans in cities from Ferguson, Missouri, to Baltimore and New York has sparked periodic and sometimes violent protests in the past two years and has spawned the Black Lives Matter movement.
Anger has intensified when the officers involved in such incidents have been acquitted in trials or not charged at all.
The shooting happened as otherwise largely peaceful protests unfolded around the United States after the shooting of Philando Castile, 32, by police near St. Paul, Minnesota, late on Wednesday. His girlfriend posted live video on the internet of the bloody scene minutes afterward, which was widely viewed.
The suspect in the Texas standoff had told police "the end is coming" and that more police were going to be hurt and killed. Brown said the suspect also told police "there are bombs all over the place in this garage and downtown".
Police said they were questioning two occupants of a Mercedes they had pulled over after the vehicle sped off on a downtown street with a man who threw a camouflaged bag inside the back of the car. A woman was also taken into custody near the garage where the standoff was taking place.
"We are leaving every motive on the table on why this happened and how this happened," Brown said.
Rawlings visited the wounded at Parkland hospital, the same hospital where President John F. Kennedy was taken after he was shot in Dallas in November 1963.
Outside, officers stood in formation and saluted as bodies of the officers were about to be transported.
One of the officers killed has been identified. He is Brent Thompson, 43, and an officer with Dallas Area Rapid Transit.