Speaking alongside President Andrzej Duda after they met at a North Atlantic Treaty Organisation summit in Warsaw, Obama said the ruling conservatives had taken some steps to address USA and European concerns but more should be done. "And that hurts. And that should trouble all of us", Obama said in his statement.
The city's police chief, David Brown, said on July 8 that the suspect told negotiators that he was upset about the police shootings of black people. "In the days ahead we are going to have to consider those realities as well".
Micah Johnson, the 25-year-old black Army veteran who carried out the sniper-style attack, killed five police while wounding seven more, as well as injuring two civilians. But when speaking on Friday, Obama noted that "police have an extraordinarily hard job and the vast majority of them do their job in outstanding fashion".
He spoke at the opening of two days of meetings with European leaders at the North Atlantic Treaty Organisation summit. The president argues rebuilding trust between communities and police will help solve crime problems and "that will make life easier for police officers".
Just a few hours earlier, he had taken the unusual step of posting on social media about the fatal shootings of Alton Sterling in Baton Rouge, Louisiana and Philando Castile in Falcon Heights, Minnesota, saying Americans should be "deeply troubled" by their deaths.
Obama said earlier there was no contradiction between supporting law enforcement and making certain biases in the justice system are rooted out.
Dallas police say four officers have died after at least two snipers opened fire during protests downtown. We will learn more undoubtedly about their twisted motivations. "That just means all lives matter". His remarks on Dallas came at the end of a session with the presidents of the European Council and European Commission, where Obama plotted a path forward after Britain's vote to exit the EU.
"I am confident that the United Kingdom and the European Union will be able to agree on an orderly transition to a new relationship, as all our countries stay focused on ensuring financial stability and growing the global economy", Obama wrote.
Both Obama and Earnest cited the 21st Century Task Force the President created in response to similar incidents in recent years and to efforts across the country to implement the committee's recommendations.
The gunshots in Dallas came amid protests nationwide over the recent police shootings.
Aides said Obama had been briefed by senior advisers and he appeared grim as he addressed reporters in the same small meeting room at a hotel here where he talked late Thursday about the killings in Minnesota and Louisiana that generated protests across the nation.
Obama has wrestled for much of his presidency with the policing issue, the "Black Lives Matter" movement and his role as the first black president in responding to them.
But he also seemed attuned to the potential for backlash directed at police.