US President Barack Obama has warned that attacks on police over racial bias will hurt the anti-racism Black Lives Matter movement, days after a sniper killed five police officers in Dallas in apparent revenge for police shootings of black people.
Mr Obama 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.
"I want to say to say to everyone concerned about... racial bias in the criminal justice system that maintaining a truthful, serious and respectful tone is going to help mobilise American society to bring about real change," Mr Obama said.
"Whenever those of us who are concerned about failures of the criminal justice system attack police, you are doing a disservice to the cause," he told a news conference in Madrid where he is on a one-day visit.
Micah Johnson, a black US military veteran of the Afghan war, opened fire on police officers on Thursday during a protest in Dallas against the fatal shootings of two black men by police in Louisiana and Minnesota the previous day.
Johnson wanted to "kill white people, especially white officers," Dallas police chief David Brown said after the attack on Thursday night.
The Black Lives Matter group said on Friday it advocated dignity, not murder, in response to the shooting that also left seven other police officers and two civilians wounded.
Mr Obama said there was legitimate criticism to be made of the criminal justice system and that citizens should continue to protest against it.
"I would hope that police organisations are also respectful of the frustrations that people in these communities feel and not just dismiss these protests as political correctness or politics or attacks on police," he said.
Mr Brown has also vigorously defended the use of a bomb mounted on a robot to kill Johnson.
In taking personal responsibility for approving the plan in the aftermath of Thursday's attack, Mr Brown said he was convinced the gunman would have sought to harm other police officers if he had hesitated to give the go-ahead.
"I approved it and would do it again if presented with same circumstances," Mr Brown told CNN on Sunday, referring to the strategy of deploying a bomb-equipped robot into a room where the suspect was holed up after his shooting rampage.
After two hours of fruitless negotiations with the gunman, Mr Brown asked senior officers to "use their imaginations" to devise a strategy to disable the shooter, later identified as Micah Xavier Johnson, 25, a former US Army Reserve soldier who authorities said embraced black nationalism.
"He seemed very much in control and very determined to hurt other officers," said the chief, who revealed that Johnson taunted negotiators and asked them how many officers he had hit with gunfire. "Without our actions, he would have, he would have hurt more officers."
Mr Brown said he stood by his decision but understood why questions have been raised about the use of deadly force against the gunman, rather than opting for a non-lethal method to disable him.
"I appreciate critics but they are not on the ground. And their lives are not at risk," the chief said.