PHOENIX (AP) — Former Sheriff Joe Arpaio was convicted of a criminal charge Monday for refusing to stop traffic patrols that targeted immigrants, marking a final rebuke for a politician who once drew strong popularity from such crackdowns but was ultimately booted from office as voters became frustrated over his headline-grabbing tactics and deepening legal troubles.

The verdict from U.S. District Judge Susan Bolton represents a victory for critics who voiced anger over Arpaio’s unusual efforts to get tough on crime, including jailing inmates in tents during triple-digit heat, forcing them to wear pink underwear and making hundreds of arrests in crackdowns that divided immigrant families.

Arpaio, who spent 24 years as the sheriff of metro Phoenix, skirted two earlier criminal investigations of his office. But he wasn’t able to avoid legal problems when he prolonged his signature immigration patrols for nearly a year and a half after a different judge ordered him to stop. That judge later ruled they racially profiled Latinos.

The lawman who made defiance a hallmark of his tenure was found guilty of misdemeanor contempt-of-court for ignoring the 2011 court order to stop the patrols. The 85-year-old faces up to six years in jail, though attorneys who have followed the case doubt that someone his age would be incarcerated.

Critics hoped Arpaio’s eight-day trial in federal court in Phoenix would bring a long-awaited comeuppance for lawman who had managed to escape accountability through much of his six terms.

Prosecutors say Arpaio violated the order so he could promote his immigration enforcement efforts in an effort to boost his 2012 re-election campaign and even bragged about his continued crackdowns.

He had acknowledged prolonging his patrols but insisted it was not intentional.

He blamed one of his former attorneys in the profiling case for not properly explaining the importance of the court order. His defense also focused on what his attorneys said were weaknesses in the court order that failed to acknowledge times when deputies would detain immigrants and later hand them over to federal authorities.

Unlike other local police leaders who left immigration enforcement to U.S. authorities, Arpaio made hundreds of arrests in traffic patrols that sought out immigrants and business raids in which his officers targeted immigrants who used fraudulent IDs to get jobs.

The efforts are similar to local immigration enforcement that President Donald Trump has advocated. To build his highly touted deportation force, Trump is reviving a long-standing program that deputizes local officers to enforce federal immigration law.

Arpaio’s immigration powers were eventually stripped away by the courts and federal government.

The contempt-of-court case marked the first time federal authorities had prosecuted Arpaio on a criminal charge, though his office had been the subject of past investigations.

Federal authorities had looked into Arpaio’s misspending of $100 million in jail funds and his criminal investigations of political enemies. Neither investigation led to prosecution of the sheriff or his employees.

Arpaio’s criminal charges are believed to have contributed heavily to his crushing defeat in November to little-known retired Phoenix police Sgt. Paul Penzone.

Arpaio was ousted in the same election that sent Trump to the White House. Trump used some of the same immigration rhetoric that helped make Arpaio a national figure in the debate over the U.S.-Mexico border.