Warsaw/Dallas: President Barack Obama urged Americans on Saturday not to see the country as being riven into opposing groups, seeking to soothe raw emotions after the attack that killed five policemen in Dallas and the high-profile police shootings of two black men in Minnesota and Louisiana.
"As painful as this week has been, I firmly believe that America is not as divided as some have suggested," Obama said at the start of a news conference during a trip to Poland.
Thursday's attack in Dallas by a black former US Army reservist who expressed a desire to "kill white people" added a new layer to the emotional national debates over racial injustice and gun violence.
"We cannot let the actions of a few define all of us," Obama said, adding that he did not believe that the country was descending into the polarisation seen in the 1960s.
"As tough, as hard, as depressing as the loss of life this week was, we've got a foundation to build on," he said.
Authorities have named Micah Johnson as the lone gunman in the Dallas attack, saying he had served in Afghanistan, embraced militant black nationalism, professed anger over police shootings and a desire to "kill white people, especially white officers."
"The demented individual who carried out those attacks in Dallas, he's no more representative of African-Americans than the shooter in Charleston was representative of white Americans or the shooter in Orlando or San Bernardino were representative of Muslim-Americans," Obama said, referring to a string of mass shootings in roughly the past year.
"They don't speak for us. That's not who we are."
Seven other officers and two civilians were wounded in the ambush in downtown Dallas.
Johnson, 25, was killed by a bomb-carrying robot deployed against him in a parking garage where he had holed up and refused to surrender during hours of negotiations with police, authorities said on Friday.
The attack came at the end of a rally to protest police shootings - prompted by the deaths of Philando Castile, 32, near St.
Paul, Minnesota, on Wednesday, and Alton Sterling, 37, in Baton Rouge, Louisiana, on Tuesday.
While Thursday's attack stunned Dallas into mourning, it did not stop demonstrations against police killings around the country.
Thousands of protesters took to the streets in several cities on Friday for a second day.
They clogged roadways in New York, Atlanta and Philadelphia, and events in San Francisco and Phoenix also drew large crowds.
More demonstrations were planned for Saturday in Minnesota, Louisiana, New York and Washington, D.C.
At least two protests were planned in Baton Rouge, and demonstrators expected to gather in Minneapolis in late afternoon for a rally.
Demonstrations were also expected on Saturday night, in New York kicking off at the Brooklyn Bridge, and in Washington at the African American Civil War Memorial.
Police use of force, particularly against African-Americans, has come under intense and sometimes angry scrutiny in the past two years because of a string of high-profile deaths in cities from Ferguson, Missouri, to New York.
The death toll in Dallas was the highest for US police in the line of duty from a single event since the Sepember. 11, 2001, attacks on New York and Washington.
It was especially devastating for the city, which struggled for decades to heal scars left by the 1963 assassination of President John F.
Kennedy.