A suspect in the gun attack on police in the heart of Dallas told officers he was upset over recent police shootings of black men and wanted to kill white people, according to officials.
The suspect died after a stand-off with police following the attacks which left five officers dead and seven injured during protests over two recent fatal police shootings of black men.
Police Chief David Brown said at a news conference that the suspect made the comments before he was killed by an explosive used by police.
Three people are in custody, Mr Brown said. The fourth suspect died after exchanging gunfire with officers in a city centre parking garage as he reportedly made threats about bombs, according to mayor Mike Rawlings.
Mr Rawlings said the suspect died after officers used explosives to “blast him out”, but added he was not sure how he died or what weapons were found on him.
Police sealed off the city centre but later tweeted that primary and secondary sweeps for explosives were complete and no explosives had been found.
The gunfire broke out as hundreds of people were gathered to protest over incidents in Baton Rouge, Louisiana, and St Paul, Minnesota.
The Dallas shootings killed four city police officers and one officer with Dallas Area Rapid Transit, which operates buses and the state of Texas’s largest municipal rail system.
Mr Brown told reporters the snipers fired “ambush style” on the officers, and Mr Rawlings said two members of the public were wounded in the gunfire.
Video footage from the scene showed protesters marching about half a mile from City Hall, when the shots erupted and the crowd scattered, seeking cover.
Mr Brown said that it appeared the shooters “planned to injure and kill as many officers as they could”.
The attacks made Thursday the deadliest day in US law enforcement since the September 11 terrorist attacks in 2001, according to the National Law Enforcement Officers Memorial Fund.
The search for the shooters stretched throughout the city centre, an area of hotels, restaurants, businesses and some residential apartments. The area is a few blocks away from Dealey Plaza, where President John F Kennedy was assassinated in 1963.
The scene was chaotic, with helicopters hovering overhead and officers with automatic rifles on street corners.
It has been a devastating night. We are sad to report a fifth officer has died.Dallas Police Chief, David Brown
“Everyone just started running,” Devante Odom, 21, told the Dallas Morning News. “We lost touch with two of our friends just trying to get out of there.”
Carlos Harris, who lives nearby, told the newspaper that the shooters “were strategic. It was tap, tap, pause. Tap, tap, pause”.
Mr Brown said police do not have a confirmed motive for the attacks or any information on the suspects. He said they “triangulated” in the area where the protesters were marching and had “some knowledge of the route”.
Video posted on social media appeared to show a gunman at ground level exchanging fire with a police officer who was then felled.
Authorities have not determined whether any protesters were involved with or were complicit in the attack.
One woman was taken into custody in the same parking garage as the stand-off, Mr Brown said. Two others were taken into custody during a traffic stop.
Mr Rawlings said at a news conference that authorities were asking people to stay away from the city centre: “This is still an active crime scene. We’re determining how big that crime scene is.”
A map was being posted online showing an area where people should avoid, he said.
Dallas Area Rapid Transit said in a statement that 43-year-old Brent Thompson was the first officer killed in the line of duty since the agency formed a police department in 1989.
“Our hearts are broken,” the statement said.
Theresa Williams said one of the injured civilians was her sister, 37-year-old Shetamia Taylor.
Ms Williams said her sister was at the protests with her four sons, aged 12 to 17. When the shooting began, Ms Taylor threw herself over her sons, Ms Williams said. She was undergoing surgery after being shot in the right calf.
Texas governor Greg Abbott released a statement saying he had directed the Texas Department of Public Safety director to offer “whatever assistance the City of Dallas needs at this time”.
“In times like this we must remember - and emphasise - the importance of uniting as Americans,” Mr Abbott said.