President Obama Warns 'Hostile' Rhetoric Against Police Hurts Reform Efforts

PHOTO: President Barack Obama give a speech at The Royal Palace in Madrid, Spain, July 10, 2016. PlayBorja B. Hojas/Getty Images
WATCH Obama Warns 'Hostile' Rhetoric Against Police Hurts Reform Efforts

President Obama said today that attacking police officers -- physically or verbally -- can only hurt the cause of reform in the criminal justice system, but cautioned that the actions of a few should not be used to discredit the entire Black Lives Matter movement.

The president, speaking before his departure from Spain, weighed in on domestic turmoil in the U.S. in response to a question regarding the overnight protests by Black Lives Matter activists and criticism facing the group in general.

"Whenever those of us who are concerned about fairness in the criminal justice system attack police officers, you are doing a disservice to the cause," he said alongside Spanish Prime Minister Rajoy in Madrid.

The president encouraged separating the vast majority of peaceful protesters from those acting out, similar to his comments separating the "vast majority" of police officers to those who harbor racism in carrying out their duties.

"Now in a movement like Black Lives Matter, there are always going to be some folks who say things that are stupid or imprudent or over-generalized or harsh," he said. "And I don’t think that we can hold well-meaning activists who are doing the right thing at peaceful protests responsible for everything that is uttered at the protest site."

He then cautioned activists against rhetoric that fails to acknowledge or take into account what he described as the good work done by police across the country, citing that the Dallas Police Department has made progress in adopting reforms, resulting in a drastic drop in crime rates there.

"First of all any violence directed at police officers is a reprehensible crime and it needs to be prosecuted," Obama said. "But even rhetoric -- if we paint them in broad brush strokes without recognizing that the vast majority of police officers are doing a really good job and are trying to protect people and do so fairly -– if our rhetoric does not recognize that then we are going to lose allies in the reform cause."

Obama, who has met at the White House with members of the Black Lives Matter movement, then said he believed "what the overwhelming majority of people who are involved in the [movement] really want to see is a better relationship between police and the community so that they can feel that it is serving them."

"America over time has benefited from free speech," he said, listing civil rights, union, and environmental movements as examples of how protest has helped to shape America in positive ways.

Protests erupted throughout the America's major cities this week in the wake of police shootings of two black men in Baton Rouge, Louisiana and St. Paul, Minnesota that were captured on cell phone video and replayed frequently on television and social media. One such protest turned violent when five police officers were killed by a sniper in Dallas, Texas on Thursday night.

ABC News' Michael Edison Hayden contributed to this report.

Obama was forced to cut his foreign trip short as a result of the violence. Instead of spending two days sightseeing in southern Spain, and then attending to additional official state business in Madrid, the White House crammed the bulk of his schedule into Sunday.