A black US Army reservist who served in the Afghan war and said he wanted to “kill white people” took part in an attack in which five police officers were shot dead at a protest decrying police shootings of black men, officials said on Friday.
Seven other police officers and two civilians were wounded in the ambush in downtown Dallas on Thursday night, officials said.
Police killed the gunman, identified by a US government source as Micah Xavier Johnson, with a bomb-carrying robot after cornering him in a parking lot, ending an hours-long stand-off.
The sound of gunfire from a high-powered rifle sent a panicked crowd of hundreds of protesters screaming and running for their lives near the end of a march to protest police killings of black men this week in Minnesota and Louisiana.
Police officers at the time believed they were under attack by several gunmen in multiple locations.
The Louisiana and Minnesota shootings, both now the subject of federal investigations, were the latest in a series of police killings that have triggered protests over police use of force against black suspects and racial disparities in the American criminal justice system.
Black Lives Matter, a decentralised movement, arose after those killings to protest the treatment of black people by US law enforcement.
"This was a well-planned, well-thought-out, evil tragedy by these suspects. And we won't rest until we bring everyone involved to justice," Dallas Police Chief David Brown said. "We are determined to not let this person steal this democracy from us."
During lengthy negotiations with police, the gunman told reporters he was angry about the Louisiana and Minnesota killings, Brown told reporters.
“The suspect said he was upset about Black Lives Matter,” said Brown, who is black. “The suspect said he was upset at white people. The suspect stated that he wanted to kill white people, especially white officers.”
Johnson was a member of a group called "Black Panther Party Mississippi" on Facebook, which has over 200 members. Earlier this month he shared a video showing what he described as white people killing what looked like dolphins or whales.
“Look at the joy on their faces. Why do so many whites (not all) enjoy killing and participating in the death of innocent beings,” Johnson wrote. Its authenticity could not be immediately confirmed.
Authorities said the gunman fired at least some of the shots in the attack but have not excluded the possibility that other shooters were involved. Details on how the shootings unfolded remained unclear.
It also was not clear how one person could have shot so many officers, though video of the attack taken by a witness shows a gunman carrying an assault-style weapon and carrying large amounts of ammunition.
The video shows a man with a rifle crouching at ground level and charging at and then shooting another person who appeared to be wearing a uniform. That person then collapses to the ground.
Reuters could not immediately confirm the authenticity of the video.
It was the deadliest day for police in the United States since the September 11th, 2001, attacks.
Deployed to Afghanistan
The US Army said Johnson had served as a private first class in the Army Reserve, made up of part-time soldiers, and was deployed to Afghanistan from November 2013 to July 2014. It said Johnson served from March 2009 to April 2015 and was a carpentry and masonry specialist with the 420th Engineering Brigade based in Texas.
President Barack Obama called the shooting "a vicious, calculated and despicable attack on law enforcement".
Obama, who was in Poland for a Nato summit and has been stymied by the Republican-led Congress in his bid for new gun control laws, added, "We also know when people are armed with powerful weapons, unfortunately it makes attacks like these more deadly and more tragic."
Three of the slain officers were identified on Friday. One was Brent Thompson (43), who joined the Dallas Area Rapid Transit police department in 2009, according to police. Another was Patricio Zamarripa (32), a US Navy veteran, according to his family. Also killed was Michael Krol (40), according to the Wayne County Sheriff's Office in Michigan, where he used to work.
Reverend Jeff Hood, an organiser of Thursday night's protest in Dallas, said he had been chatting with some of the police officers on the street when gunfire erupted.
‘Heartache and devastation’
“I saw what I believe were two police officers that went down. I didn’t know what to do,” Hood told reporters on Friday. “If we continue to turn to violence, we are going to continue to see heartache and devastation.”
A string of killings of black men and boys by police in cities including Ferguson, Missouri, New York, Baltimore, Chicago, Cleveland, Tulsa, Oklahoma and North Charleston, South Carolina gave rise to the Black Lives Matter movement against excessive police force.
A Twitter account describing itself as representing the Black Lives Matter movement sent the message: “Black Lives Matter advocates dignity, justice and freedom. Not murder.”
Police in Dallas said they were questioning two occupants of a Mercedes they had pulled over after seeing a man throwing a camouflage bag inside the back of the vehicle, which then sped off on a downtown street. A woman was also taken into custody near the garage where the stand-off took place.
The Dallas shootings happened as otherwise largely peaceful protests unfolded around the United States after the police shooting of Philando Castile, a 32-year-old black man, on Wednesday during a traffic stop near St Paul, Minnesota.
The day earlier, police in Baton Rouge, Louisiana, shot dead Alton Sterling (37), while responding to a call alleging he had threatened someone with a gun.
Both killings were captured on video, with Castile’s girlfriend broadcasting the bloody aftermath of his shooting live on the internet.
Cleveland police officials have tightened their security plan for the July 18-21 Republican National Convention as a result of the shootings of in Dallas, Deputy Police Chief Ed Tomba said.
Presidential candidates Republican Donald Trump and Democrat Hillary Clinton cancelled planned events following the attack.
“Our nation has become too divided. Too many Americans feel like they’ve lost hope,” Mr Trump said in a statement. “This is a time, perhaps more than ever, for strong leadership, love and compassion. We will pull through these tragedies.”
Ms Clinton said on Twitter: “I mourn for the officers shot while doing their sacred duty to protect peaceful protesters, for their families & all who serve with them.”
‘Person of interest’
Mark Hughes, the man who turned himself after a Dallas police named him as "person of interest" and issued a picture of him carrying a gun, talked to the media after being released.
“I could easily have been shot,” he told CBS. He said he flagged down a police officer as soon as he was told he had been named as a suspect. He said he was interrogated for 30 minutes and accused the police of lying about his movements. “The system is trying to get me,” he said.
Dallas police apologised to Hughes. He said he was not satisfied with this after getting death threats on social media.
The US federal aviation administration issued a temporary flight restriction over downtown Dallas after the shooting. Facebook also activated safety checks for its users.
Additional reporting - Agencies