Former Sheriff Joe Arpaio of Maricopa County, Arizona, was found guilty Monday on criminal contempt charges linked to his controversial “immigration sweeps.”

The 84-year-old lawman, who once styled himself as “America’s toughest sheriff,” could face up to six months behind bars. The verdict, which follows a decade-long legal showdown, also marks the demise of Arpaio, an outspoken Trump surrogate who recently lost his bid for a seventh term as sheriff of Arizona’s most populous county.

The case stemmed from a 2007 class action lawsuit filed by the American Civil Liberties Union that accused Arpaio of targeting and unlawfully detaining Latino residents suspected of being undocumented immigrants.

In 2011, the U.S Justice Department drew damning conclusions after a three-year investigation into Maricopa County Sheriff’s Office; one federal investigator described his practices as the “most egregious” case of racial profiling he’d ever seen. A federal judge that year ordered Arpaio to stop illegally detaining Latinos suspected of being in the country without documentation, but Arpaio continued regardless, and implored his supporters to help him pay his legal fees to protect him against the Obama administration and its “rampant UNFOUNDED charges of racism and racial profiling.”

In May 2016, a federal judge found Arpaio guilty of civil charges of contempt, and pursued criminal charges.

Arpaio claimed during the trial that he had unintentionally violated the judge’s orders. The judge alleged that Arpaio had continued with his anti-immigrant sweeps in order to help his 2012 bid for re-election.

Arpaio’s sentencing is slated for October 5, and he faces up to six months behind bars.