PRESIDENT TRUMP hinted for weeks that he might pardon former Arizona sheriff Joe Arpaio. When he finally did so on Friday, the White House’s official statement lauding Mr. Arpaio failed to mention the charge for which Mr. Trump had granted clemency: a criminal conviction of contempt of court for defying an order to halt racial profiling. Whatever the White House may say about Mr. Arpaio’s “selfless public service,” the president’s decision is a slap in the face to Latinos and undocumented immigrants and a gift to Mr. Trump’s farthest-right supporters.

Despite Mr. Trump’s suggestion that Mr. Arpaio was “convicted for doing his job,” a federal judge found the former sheriff guilty of contempt when he refused to cease rounding up suspected undocumented immigrants on the basis of appearance alone. But Mr. Arpaio’s abuse of his authority as sheriff went well beyond racial profiling. With pride, he detained inmates in inhumane conditions and humiliated them in the name of deterring crime. And like Mr. Trump, he rose to national prominence by casting doubt on whether Barack Obama was born in the United States.

Mr. Trump did not consult with the Justice Department before pardoning Mr. Arpaio. Indeed, the former sheriff had not even applied for a pardon through the long-standing Justice Department system. Perhaps that’s appropriate: The department’s guidelines state that pardon applicants should show remorse and atonement for their actions. Mr. Arpaio has shown none. (He is now pushing for the federal court to vacate its verdict against him.)

A pardon was Mr. Trump’s second choice. Last spring, the president reportedly asked Attorney General Jeff Sessions whether the Justice Department might be able to drop the then-ongoing investigation of Mr. Arpaio. When Mr. Sessions informed Mr. Trump that such a request would be inappropriate, the president settled on clemency instead.

The president’s authority to bestow pardons is nearly without restraint. But granting clemency for a defendant convicted of contempt of court speaks to the same disdain toward the judicial system that Mr. Trump has displayed in his attacks on “so-called” judges. (Mr. Arpaio has taken a similar approach, decrying his conviction as a “political witch hunt.”) And Mr. Trump’s discussion with Mr. Sessions recalls his suggestion to then-FBI Director James B. Comey to drop the bureau’s investigation of Michael Flynn, Mr. Trump’s former national security adviser.

This pardon is not only a mark of Mr. Trump’s inclination to inflame rather than bind up the nation’s wounds. It is also a warning of his lack of respect for the independence of the courts and of law enforcement in a country governed by the rule of law — a worrying characteristic in a president facing an ongoing special counsel investigation. But Mr. Trump should take the outraged response to Mr. Arpaio’s pardon from across the political spectrum as a warning, too: a sign of the resistance he will encounter if he chooses to issue further pardons, particularly in the Russia affair, on the basis of political concerns rather than those of justice.