Johnson was motivated by the recent fatal police shootings of two black men by police in Louisiana and Minnesota, which sparked days of nationwide protests and America's biggest debate over race since the 1960s.

Mr Obama was due to speak at a private memorial service for the officers alongside former president George W. Bush, who lives in Dallas. He was also due to meet privately with the officers' families and give "some measure of comfort", the White House said.

Some police officials have accused Mr Obama of fuelling division by being insufficiently supportive of them.

William Johnson, executive director of the National Association of Police Organisations, said there was a "war on cops" and Mr Obama was the "Neville Chamberlain of this war". Mr Obama met for two hours with senior police officials, including Mr Johnson, in Washington before heading to Dallas.

The president told them he was open to allowing police forces to buy more military surplus equipment from the Pentagon like armoured vehicles and grenade launchers. He also vowed to act as an intermediary between police and protesters, saying: "I'm your best hope."

Dallas Police chief David Brown sounded exasperated as he urged politicians in Washington to make progress on gun control.