Thousands of protesters took to the streets in US cities on Friday after a black extremist shot dead five cops during a peaceful march against police brutality in Texas.
President Barack Obama said he will cut short a foreign trip and visit Dallas next week as a shooting rampage by the black army veteran bent on killing white police triggered urgent calls to mend troubled race relations in the United States.
Police found bomb-making materials and a weapons cache at the home of 25-year-old Micah Johnson, a Dallas area resident who gunned down the officers before dying in a standoff with police.
Five officers were killed in the late Thursday shooting, including a Dallas transit cop, while seven other officers and two civilians were wounded.
People write condolence notes and lay flowers at a growing memorial in front of the Dallas Police Headquarters on Friday.
While the White House ruled out any link between the gunman and known "terrorist organisations," Johnson's Facebook page ties him to several radical black movements listed as hate groups.
Described to police as a "loner" with no prior criminal record, Johnson told negotiators before he died that he wanted to kill white cops in retaliation for the recent fatal police shootings of two black men.
The US Army said that Johnson served as a reservist for six years, including a tour of duty in Afghanistan.
The rampage revives an emotional debate over lethal use of force by police, and problems of alleged police bias towards racial minorities, especially African-Americans.
Leaders of the Black Lives Matter protest movement condemned the Dallas violence, but vowed to uphold planned weekend marches.
Vast crowds marched on Friday in US cities including Atlanta, Georgia; Houston, Texas; and San Francisco, while scores protested outside the White House.
Addressing thousands of people at a prayer service in honour of the fallen officers, Dallas Mayor Mike Rawlings urged Americans to "step up" to heal the country's racial wounds.
"We will not shy away from the very real fact that we as a city, as a state, as a nation are struggling with racial issues," he told the crowd.
Rawlings echoed Obama's message that black lives matter -- and so do "blue" lives, those of police officers.
"We must step up our game and approach complicated issues in a different way," Rawlings said. "And race is complicated."
'This must stop'
Obama, who ordered flags on government buildings lowered to half-mast for five days, said that there was "no possible justification" for violence against police.
The president commented on the attacks from the Polish capital, where he was attending a Nato summit. He condemned the shootings as "vicious, calculated and despicable."
The White House said Obama would return to the United States late on Sunday, one day ahead of schedule, and visit Dallas early next week.
The shootings -- which left nine wounded, seven of them police officers -- sparked chaos as people ran for their lives during a march by several hundred demonstrators in the city of 1.2mn, near the site where president John F. Kennedy was assassinated in 1963.
The peaceful Dallas protest was one of several nationwide over the deaths of Alton Sterling in Louisiana and Philando Castile in Minnesota that prompted Obama to make an emotional appeal for urgent police reform.
The ambush marks the single biggest loss of life for law enforcement in the United States since the September 11, 2001 terror attacks.
"This must stop -- this divisiveness between our police and our citizens," Dallas police chief David Brown said.
'Every rabbit trail'
Johnson was killed in a tense showdown with police in a parking garage, by a bomb robot sent in by officers after hours of negotiations and an exchange of fire.
"This was a well-planned, well-thought out, evil strategy," said Brown of the gunman.
Bomb-making materials, weapons and ammunition were found in Johnson's home.
"He said he was upset about the recent police shootings," Brown said. "The suspect said he was upset at white people. The suspect stated he wanted to kill white people, especially white officers."
Earlier, officials said three other people had been detained, but it was unclear if any remained in custody.
US Homeland Security Secretary Jeh Johnson said the gunman appeared to have acted alone.
However Texas Governor Greg Abbott said police would "continue down every rabbit trail... ensuring that we eliminate any other possible suspects or co-conspirators who may have aided this gunman in any way."
The gunman told police he was not affiliated with any organised groups.
But Johnson's Facebook page ties him to a number of organisations listed as hate groups by the Southern Poverty Law Center, which studies such movements in the United States.
Groups that he "liked" include the New Black Panther Party (NBPP) and the Nation of Islam, both known for expressing virulently anti-Semitic and anti-white views, the SPLC said in a statement.
On his Facebook page, Johnson appears with his fist raised wearing an African-style tunic against the backdrop of the red, black and green Pan-African flag, all reminiscent of the US black power movement of the 1960s.
Another of his "likes" is a group called the African American Defense League, whose leader called this week for bloody retaliation after the fatal shooting in Louisiana.