President Trump has managed what few others could achieve, giving activists on both sides of the Black Lives Matter-Blue Lives Matter divide something to agree on. In his remarks to law enforcement officers gathered at the Suffolk County Community College in Brentwood, N.Y., on July 28, Mr. Trump encouraged police not to worry about roughing up “thugs” when getting them into a squad car. While several officers could be seen laughing and clapping behind the president, there has been near universal condemnation of Mr. Trump’s comments by the law enforcement community as well as civil rights groups.

There has been near universal condemnation of Mr. Trump’s comments by the law enforcement community as well as civil rights groups.

Mr. Trump’s remarks come at a critical time for police-community relations. A recent Gallup poll showed a return to a 25-year average of confidence in the police after several years of unrest and declining approval in the wake of high-profile police shootings in Ferguson, Mo., North Charleston, S.C., and Cleveland, Ohio. Today, 57 percent of Americans say they have “a great deal” or “quite a lot” of confidence in law enforcement. But those gains mask continued mistrust of the police among minority communities. Since 2014, confidence in law enforcement officials has dropped 5 percentage points among African-Americans (to 30 percent) and 14 percentage points among Latinos (to 45 percent).

Whether or not the president was joking, as his spokeswoman Sarah Huckabee Sanders has claimed, police chiefs from California to Florida said that Mr. Trump’s tacit approval of breaking the law did them no favors in their work to rebuild community trust. Charlie Beck, the Los Angeles police chief, tweeted in response that police misconduct “serves only to undermine the hard work and sacrifice they make to keep this city safe.”

The police know better than politicians that repairing relationships with the neighborhoods they serve will do much more to improve public safety than roughing up a few suspects. But there are less utilitarian reasons to fight police brutality as well. Brutality, corruption and an “us-versus-them” mentality in the ranks undermine what is for many officers a sincere vocation to protect and serve.

Pope Francis recognized the importance of that vocation in a speech marking the 200th anniversary of the Italian police force in 2014. The vocation of police officers, the pope said, “is expressed in service to others and commits you to correspond every day to the confidence and esteem that the people place in you.” A vocation of service can never simply be against criminals; it must be on behalf of communities.