Joe Arpaio, the sheriff of Maricopa County, Ariz., walks onto a stage at the Republican National Convention in Cleveland in July. (Paul Sancya/Associated Press)

IN SHERIFF Joe Arpaio’s distorted world view, he now faces criminal charges and the possibility of prison time because he has been targeted by the “corrupt Obama Justice Department” and an administration “more concerned with the rights of illegal aliens and criminals” than with protecting America, as he told Republicans at their convention in Cleveland. In fact, Mr. Arpaio, who runs the sheriff’s office of Maricopa County, Arizona’s most populous jurisdiction, is not in trouble for defying Washington but for disobeying a federal judge who, inconveniently for the sheriff, was appointed by George W. Bush.

Mr. Arpaio, a big-mouthed bigot in the tradition of Bull Connor, fancies himself a very tough fellow. He has had a long run ignoring orders issued by Judge G. Murray Snow of U.S. District Court in Arizona, who oversees a case involving efforts to stop the sheriff’s office from racially profiling Latinos. At every turn, Mr. Arpaio has dodged, dissembled and defied the judge, pretending compliance while at the same time making no fundamental changes to his office’s practices.

The judge finally ran out of patience in August, referring the sheriff for prosecution. Last month, he was charged with criminal contempt of court; he may face obstruction of justice charges, too.

The 84-year-old sheriff feels aggrieved. In a statement, he demanded to know why Hillary Clinton, former attorney general Eric Holder and former IRS official Lois Lerner — a pantheon of bogeymen for staunch conservatives — can escape consequences for their supposed misdeeds while “someone like me who dares enforce the rule of law is held to a much different standard.”

As it happens, the rule of law is a useful standard in this situation. And the sheriff is the one who’s flouted it for years.

His deputies, who patrol Phoenix and surrounding areas, have made traffic stops based on nothing more than their impression that drivers or passengers were Hispanic, and potentially undocumented. In many cases, the people they stopped were citizens or legal residents of the United States, and stops were often made in the absence of any violation of state or local law.

Mr. Snow rightly found that the Constitution prohibits the sort of racial profiling that Mr. Arpaio’s office practiced on a daily basis and forbade sheriff’s deputies from using race or ethnicity to help determine which vehicles to pull over. He also ordered sweeping measures to prevent further such problems, including training deputies in proper procedures and improved record-keeping, plus an independent monitor to check compliance.

Mr. Arpaio remained defiant. His office destroyed internal records and made no good-faith effort to investigate or discipline officers who violated the judge’s guidelines. In the face of ongoing efforts to cover up wrongdoing by sheriff’s deputies, Mr. Snow stripped the sheriff of his responsibility for internal affairs investigations.

Mr. Arpaio’s tentative trial date is next month. With luck it will mark the end of his years-long crusade to harass Hispanics and run what amounts to a rogue law enforcement operation, accountable to no one. No one, that is, but the voters of Maricopa County, who would be within their rights to deprive him of a seventh term and vote him out of office on Nov. 8.