/ Updated  / Source: Associated Press
By Associated Press

Just weeks after being charged with a crime for ignoring a judge's order to stop his immigration patrols, Sheriff Joe Arpaio battled for a seventh term Tuesday.

The sheriff of metro Phoenix faced his toughest bid for re-election in his two-decade career, with a strong challenge from retired police Sgt. Paul Penzone. The 84-year-old sheriff has experienced his worst legal defeats over the last four years, including a judge's ruling that his officers had racially profiled Latinos.

Arpaio represents the last vestige of a decade-old political movement in Arizona that called for local police to crack down on illegal immigration. The movement lost steam after immigrant-smuggling traffic into Arizona declined and several state immigration laws were thrown out by the courts.

But anti-immigration rhetoric from Donald Trump has energized the state's conservative base and given the Republican sheriff an ally. Arpaio has introduced the GOP nominee at rallies and gave a speech at the Republican National Convention.

The sheriff earned high marks from voters early in his tenure for jailing prisoners in tents in the desert heat and dressing them in pink underwear. His popularity has waned over the past few elections, but a devoted base of supporters and impressive campaign fundraising have helped him pull out wins.

RELATED: Arizona Sheriff Joe Arpaio Officially Charged With Criminal Contempt of Court

Over the last four years, the courts have stripped Arpaio of his power to conduct immigration crackdowns. His officers were found to have profiled Latinos in traffic patrols that targeted immigrants. And Arpaio was charged with criminal contempt-of-court for prolonging his patrols after he was ordered to stop them.

The sheriff, who has acknowledged the contempt violations but insists they were unintentional, has pleaded not guilty to the charge. If convicted, he would face up to six months in jail but would not be barred from holding office.

Maricopa County Sheriff Joe Arpaio attends a news conference at the Maricopa County Sheriff's Office Training Center Auditorium in Phoenix, Arizona July 17, 2012. JOSHUA LOTT / Reuters file

His plan of attack against Penzone, who lost to the sheriff in 2012, consisted mostly of TV ads that claimed Penzone assaulted his wife in a 2003 dispute. The Democrat denies the claim and sued Arpaio, alleging defamation.

Arpaio has faced heavy criticism over the cost of the profiling case. So far, taxpayers have shelled out $48 million in legal fees, and the costs are expected to rise to $72 million by next summer, largely because of Arpaio's contempt violations.

RELATED: Feds to Pursue Contempt Charges Against Sheriff Joe Arpaio

Karen Cooney, a retiree in Phoenix who described herself as a conservative-leaning Democrat, said she voted for Penzone. She said she disliked signs that Arpaio posted on sheriff's vehicles asking people to report immigrants to the authorities.

"The sheriff's race was a no-brainer because I have only been here a few short years and I just do not agree with Arpaio's means and methods," Cooney said.

Crystal Burge, a homemaker from Phoenix, said she voted for Arpaio because of his tough jail policies, including his complex of jail tents.

"I really like his philosophy on the outdoor jails," Burge said.

Arpaio still holds a strong fundraising advantage over Penzone. The sheriff has raised $12.3 million, most of it from people living in other states who supported his past immigration crackdowns.

Penzone has raised $1 million and gotten a boost from $2.9 million in campaign mailers and commercials from an anti-Arpaio group funded largely by liberal hedge-fund tycoon George Soros.

Like Penzone, the Soros-funded group has attacked Arpaio for botching investigations into hundreds of sex-crime cases.

Follow NBC News Latino on Facebook, Twitter and Instagram.