THE ESSENCE of Joe Arpaio’s long reign as sheriff of Arizona’s Maricopa County, whose 4 million residents in and around Phoenix make it one of the nation’s biggest localities, was lawlessness masquerading as law enforcement. Blatant racial profiling, inhumane treatment of prisoners and contempt for federal court orders — this was the stuff on which Mr. Arpaio staked his relentlessly self-promoted reputation as “America’s toughest sheriff.”

Now Mr. Arpaio, who lost a reelection bid for a seventh term in the fall after voters tired of shelling out tens of millions of dollars in legal fees on his behalf, is facing a day of reckoning. In a trial that began Monday in federal court, Mr. Arpaio stands accused of criminal contempt of court for having thumbed his nose at a federal judge who ordered a halt to Mr. Arpaio’s traffic patrols, which singled out Hispanics on the basis of nothing more than their appearance, for immigration enforcement.

Lawyers for Mr. Arpaio, who is 85, have tried out an array of legal strategies in his defense, variously arguing that he did not understand the order , or that the order was ambiguous or invalid. His supporters argue that the entire case is a political vendetta orchestrated by holdovers from the Obama administration in the Justice Department.

Unfortunately for the sheriff, the most damning evidence against him are the words he himself uttered, unambiguously, after U.S. District Judge G. Murray Snow, in December 2011, ordered his office to halt detentions based on nothing more than suspicion that a person might be in violation of federal immigration law. “I’m still gonna do what I’m doing,” Mr. Arpaio told the media in April 2012 . “I’m still gonna arrest illegal aliens.”

The sheriff’s insolence — an open admission that he would persist in conduct the judge had ruled was discriminatory — translated into open defiance. For at least 18 months, his deputies continued to racially profile motorists for detention. Some 170 people were stopped in that period, even as Mr. Arpaio’s own lawyer at the sheriff’s department warned him to stick to enforcing the state laws he was sworn to uphold, not federal ones.

Mr. Arpaio’s defiance didn’t sit well with the judge, who found the sheriff in civil contempt of court and referred the case to the Justice Department, which, having concluded that Mr. Arpaio’s policy was intentional, brought criminal contempt charges against him. If convicted, he could face up to six months in prison.

As a federal prosecutor said in his opening argument for the sheriff’s trial, this was a day Mr. Arpaio never imagined would come. He fancied himself above the law, not its instrument in one county. Whatever the outcome of the judicial process against him, the trial of Mr. Arpaio is the direct result of his own arrogance, and of contempt not just for a single federal judge’s order but also for the standards, norms and values of a civilized society.