"First of all, as painful as this week has been, I firmly believe that America is not as divided as some have suggested", Obama, visiting Poland, told a news conference in Warsaw. "This is not who we want to be as Americans and that serves as the basis for us being able to move forward in a constructive and positive way". The shootings again have raised questions about excessive police force, particularly against minorities.
The police department said it was taking extra safety precautions. Snipers opened fire on police officers in the heart of Dallas during protests over two recent fatal police shootings of black men.
Americans of all stripes were outraged a "deranged" individual killed the five officers in Dallas just as American have deep concerns about police shootings in Louisiana and Minnesota, said the President, speaking in Warsaw, Poland, where he was attending a North Atlantic Treaty Organisation conference.
The American flag flies at half mast outside of J. J. Hill Montessori School, where Philando Castile worked, during a demonstration for Philando Castile on July 7, 2016 in St. Paul, Minnesota. President Barack Obama, who called the attack "vicious, calculated, and despicable", will travel to Dallas early next week, cutting short his trip to Europe to attend the North Atlantic Treaty Organisation summit, the White House announced.
Obama, the first black US president whose term in office ends next January, said he hopes he has been able to get all Americans to understand the nation's hard legacy of race.
Obama is in Poland to participate in a North Atlantic Treaty Organisation summit, his last before the end of his presidential term.
"This is not who we want to be as Americans", he said.
An Army veteran killed by Dallas police after he fatally shot five officers amassed a personal arsenal at his suburban home, including bomb-making materials, bulletproof vests, rifles, ammunition and a journal of combat tactics, authorities said Friday.
He was killed by a robot-delivered bomb after the shootings, which marked the deadliest day for US law enforcement since the September 11, 2001, terrorist attacks.
But at daybreak Saturday here, the downtown streets were mostly quiet after a night when numerous buildings along the city's skyline were illuminated in blue to honor law enforcement.
"I am going to keep on talking about the fact that we can not eliminate all racial tension in our country overnight", he said.
There was an onus, he said, "on all of us to stand up, to speak out about disparities in our criminal justice system, just as it's on all of us to stand up for the police who protect us in our communities every day".
After the accusation was made, the army sent Johnson back to the US. "And since we can not have a police force that guards every person, we want people to be able to protect themselves".
The march was against the killing of black men by police.
But the protests extended well beyond Baton Rouge, and Minnesota, where Castile was shot in a St. Paul suburb. Similar protests - mostly peaceful - were held Friday in dozens of cities across the United States, and more are planned for Saturday. Events in San Francisco and Phoenix also drew large crowds. Police initially suspected more than one shooter.
Police use of force, particularly against African-Americans, has come under intense scrutiny in the past two years because of a string of high-profile deaths in cities from Ferguson, Missouri, to NY.
Dallas police had tightened security throughout the city because of an anonymous threat, spokeswoman Monica Cordova said earlier without elaborating.
Micah Xavier Johnson was a private first class in the U.S. Army Reserve serving in Afghanistan when he was accused of sexually harassing a higher-ranking female soldier in May 2014, military lawyer Bradford Glendening told ABC News.