“I’d like all sides to listen to each other,” Obama said as he answered a reporter’s question after meeting with Spain’s acting prime minister, Mariano Rajoy, during his shortened first visit to Spain as president.
It was the fourth straight day that Obama has commented on a series of distressing events back home: the fatal shootings by police of black men in Louisiana and Minnesota, and a sniper attack that killed five police officers and wounded seven in Dallas.
His appeal followed the arrests of scores of people in St Paul, Minnesota, during protests late Saturday and early yesterday that left more than two dozen law enforcement officers with injuries after they were pelted with rocks, bottles and other objects.
Obama defended the Black Lives Matter movement and the right of activists to demonstrate in cities across the United States. However, he warned that attacks on police over racial bias would hurt the anti-racism movement.
He said although most activists from the Black Lives Matter movement wanted to see better relations between communities and law enforcement, violence and overly broad criticism against police undermined the protest movement.
He said violence against police by anyone concerned about fairness in the criminal justice system does “a disservice to the cause”.
He repeated that the vast majority of US police officers are doing a good job, and rhetoric that portrays them otherwise does little to rally allies to support efforts to change a system broadly recognised as biased against minorities.
“Maintaining a truthful and serious and respectful tone is going to help mobilise American society to bring about real change,” Mr Obama said.
The president also called for balance from law enforcement.
“I would hope that police organisations are also respectful of the frustrations that people in these communities feel and not just dismiss these protests and these complaints as political correctness,” he said.
“It is in the interest of police officers that their communities trust them,” he added.
The president travelled to Spain after attending a Nato summit in Poland, but the shocking series of events at home late last week has dominated most of his public appearances.
Mr Obama was supposed to spend two days in Spain but cut the visit short because of the shootings.
“We’ve had a difficult week in the United States,” he told King Felipe VI before they met in private at the Royal Palace.
100 arrests at protests over killings by police
Protesters angry over the fatal shooting of a black man by two white Louisiana police officers held a rally at the convenience store where he was shot.
Other demonstrators gathered in front of the Baton Rouge police department and at the state capitol, demanding justice for Alton Sterling, 37, who was shot dead on Tuesday. The US Department of Justice has opened an investigation into his death.
The latest protests came after overnight demonstrations had resulted in 30 arrests. The rally outside the police building was at times tense, as protesters faced off against police dressed in riot gear. Several hundred people shouted “No justice, no peace!” and waved home-made signs as passing cars honked their support.
At one point, police in riot gear came out to clear the road, as demonstrators yelled at them.
Baton Rouge resident Marie Flowers came to the protest with her three children. She said people in the north Baton Rouge neighbourhood where the shooting happened are frustrated. She gestured to her 12-year-old son and said they were there to protect people like him.
“Black boys are being killed and this is just the culmination of what has been going on for decades,” she said.
Lael Montgomery of Baton Rouge was at the convenience store where Mr Sterling was shot: “I’ve been in active in the community for years. We have been suffering police brutality for a long time. A lot of racism has been going on here for a long time,” he said. “I have kids. They need to be raised in a better environment than they’re in.”
Members of the New Black Panther Party for Self-Defense called for the arrest of the officers involved in Mr Sterling’s shooting.
“These are human rights violations,” Krystal Muhammad shouted to the crowd at the convenience store before heading over to the police department.
Baton Rouge police said they are investigating a newspaper website’s video that appears to show an officer with his weapon drawn at one point early on Saturday morning as angry protesters confronted police.
Prominent Black Lives Matter activist DeRay McKesson was among those arrested at the Baton Rouge rally.
It was not immediately clear what prompted McKesson’s arrest. He is one of the most recognisable faces to emerge from the Black Lives Matter movement.
The former educator built a national following after he left his home and job in Minneapolis in August 2014 for Ferguson, Missouri, to document the rising anger over race relations after the police shooting of Michael Brown.
Meanwhile, in Minnesota, police used smoke bombs to clear demonstrators blocking a road in St Paul during a protest sparked by the recent police killings of black men in Minnesota and Louisiana.
Smoke bombs were used on 200 protesters as police in riot gear slowly moved in. Several officers were injured by rocks, firecrackers and other debris thrown by protesters on Saturday night.
A protest leader urged the group to march to the governor’s mansion, where protesters have gathered since the fatal police shooting on Wednesday night of Philando Castile. The 32-year-old black man was shot after being pulled over for a traffic violation in St Paul.