Media playback is unsupported on your device Media caption The BBC's James Cook reports from Dallas.

US President Barack Obama says the US is "not as divided as some have suggested" in the wake of fatal shootings involving African-Americans.

Five white police officers were shot dead by a black man, Micah Johnson, during a protest rally on Thursday.

The march was against the killing of black men by police. Two deaths this week have led to nationwide protests.

Mr Obama said "it was just not true" the US was returning "to the situation in the 60s".

His comments, on the side of a Nato summit in Warsaw, echoed those earlier of Vice-President Joe Biden, who said Americans had a duty to stand up against injustice, but that people also needed to support police.

Johnson, who was himself killed during the assault in Dallas, supported black militant groups who encouraged violence against police.

Dallas police chief David Brown said Johnson had told a negotiator that he had wanted to kill white people, especially white police officers, because he was angry about the recent shootings of black men by police.

The attack came after the police killings of Philando Castile in Minnesota and Alton Sterling in Louisiana.

Media playback is unsupported on your device Media caption A step-by-step guide to Dallas shootings

Mr Obama said Americans of "all races, all backgrounds", including many of those who were protesting, were outraged by the Dallas killings.

The unity shown in the wake of the attack was a strong foundation on which to build, he said.

"When you start suggesting that, somehow, there is this enormous polarisation and we are back to the situation in the 60s, it's just not true," he said.

"You are not seeing riots and you are not seeing police going after people who are protesting peacefully.

"We have seen almost uniformly peaceful protests and we have seen, uniformly, police handling those protests with professionalism.

"And so, as tough, as hard, as depressing as the loss of life this week, we have got a foundation to build on. We just have to have confidence that we can build on those better angels of our nature."

He also repeated his call for urgent action on gun control, saying anyone who cared "about the safety of our police officers" had a duty to address the issue.

As well as the five police officers killed, another seven were injured. Two civilians were also hurt.

Media playback is unsupported on your device Media caption Michael Mata of the Dallas Police Association: Police had built links with community

The police and the public - Tara McKelvey, BBC News, Dallas

Image copyright Reuters

The shootings of police officers have made even the critics of the police force here soften their language.

One of these critics, Greg Johnson, a stage technician, came into a convenience store with a colleague, Keelen Whitfield, during their lunch break.

Mr Johnson said he resented the way police officers carry heavy weaponry and artillery when dealing with the community. He said that they tote around the kind of weapons used in war zones.

"Why do you have to got so militarised?" he said.

Still, he didn't condone the violence. "At the end of the day, those police officers - they're innocent," he said.

Mr Whitfield said he hoped that the shootings, however brutal, might change things.

"The police may get the message to kind of tone it down on African-Americans."

Read more here: Dallas unites behind police

Johnson, 25, who officials say acted alone, was killed by remotely detonated explosives that were sent into a car park where he had taken refuge after the shootings.

He was a member of the US Army Reserve from 2009 to 2015 who had served in Afghanistan.

Bomb-making material, rifles and a combat journal were found his home in the Dallas suburb of Mesquite.

A number of gun attacks involving police officers and civilians have occurred in other parts of the US in the aftermath of the deaths in Minnesota and Louisiana.

Early on Saturday in Houston , police shot dead a man they said had pointed a gun at officers. Reports said he was black, and police say he was shot a number of times

, police shot dead a man they said had pointed a gun at officers. Reports said he was black, and police say he was shot a number of times In Missouri on Friday, a police officer was shot from behind after he walked back to his patrol car to check the driving status of a black man who he had stopped. Antonio Taylor, 31, was later arrested but the motive for the shooting is unknown

on Friday, a police officer was shot from behind after he walked back to his patrol car to check the driving status of a black man who he had stopped. Antonio Taylor, 31, was later arrested but the motive for the shooting is unknown In Georgia on Friday, an officer was shot after he responded to a call from a man who said his car had been broken into. Again, the motive is unknown

Media playback is unsupported on your device Media caption Serena Williams on Dallas

The violence was also addressed by US tennis player Serena Williams after she won her 22nd Grand Slam title at Wimbledon on Saturday.

"I do have nephews that I'm thinking, 'Do I have to call them and tell them, don't go outside. If you get in your car, it might be the last time I see you?'

"I don't think that the answer is to continue to shoot our young black men in the United States."

Protests against the recent police killings took place on Friday in cities including Atlanta, Houston, New Orleans and San Francisco.

Leaders of the Black Lives Matter organisation have condemned the Dallas killings but say planned marches, including a "Weekend of Rage" in Philadelphia, will go ahead.

A Black Lives Matter march was also held in London on Friday.