A judge has recommended that Sheriff Joe Arpaio face criminal prosecution in a contempt-of-court case.

PHOENIX — Maricopa County Sheriff Joe Arpaio trounced three rivals Tuesday to win his Republican primary in what could be the toughest campaign in his 24 years in office as he faces a storm of legal troubles stemming from his immigration patrols.

Arpaio easily beat former Buckeye Police Chief Dan Saban and two lesser-known Republicans. Arpaio has raised a staggering amount of money for a local sheriff’s race — $11.3 million and counting, most from people living in other states.

The 84-year-old lawman moves on to face the race’s sole Democrat, retired Phoenix police Officer Paul Penzone, in the Nov. 8 general election.

Arpaio is seeking a seventh term as he experiences the worst legal troubles in his career.

Over the past four years, a federal judge has ruled that Arpaio’s officers racially profiled Latinos during traffic stop, and the sheriff was found in civil contempt of court for defying court orders in the case.

The judge recently recommended that Arpaio face criminal prosecution over the contempt case for prolonging his immigration patrols months after the court ordered them stopped. He could be sent to jail if he is found in violation of criminal contempt-of-court charges.

He has thrown his support this year behind Donald Trump and stumped for the GOP nominee during his visits to Arizona. Arpaio also gave a speech at the Republican National Convention in which he said Trump would prevent immigrants from sneaking into the country.

He is scheduled to speak before Trump on Wednesday as he delivers a much-anticipated immigration speech in Phoenix.