Arizona Sheriff Joe Arpaio, an anti-immigration crusader who called himself “America’s toughest sheriff,” is out.

Arpaio, a Republican, lost his re-election to Democrat Paul Penzone on Tuesday, booting him from a job he’s held since 1993. About 52 percent of voters supported Penzone, versus about 45 percent who chose Arpaio, according to votes tallied as of Wednesday morning.

But the 2016 race proved different, with Arpaio facing a criminal contempt charge, an expensive lawsuit and determined opposition from a group focused on motivating the county’s substantial Latino population.

Arpaio’s political demise came just two weeks after he was charged with criminal contempt of court for violating a judge’s 2011 order to quit conducting immigration raids. Arpaio has said he will fight the charge, and a judge set a court date for December.

Arpaio is most famous for his hawkish approach to undocumented immigrants, his birtherism and his so-called tent city jails, where he kept inmates outside in the heat and forced them to wear pink underwear.

His actions came at a high cost to taxpayers. By next summer, the cost of defending Arpaio and the sheriff’s office in the racial profiling lawsuit is projected to hit $72 million, according to The Associated Press.

Arpaio was applauded by many conservatives ― including Republican presidential nominee Donald Trump. But his hard-line actions made him reviled locally and nationally, especially by immigrant rights activists and groups representing Latinos.

Maricopa County, like the rest of the state, has a substantial Latino population, and organizers worked hard to get more voters to the polls this year. About 30 percent of the Maricopa County population is Hispanic or Latino, according to 2015 census figures.

The group People United for Justice had been conducting a campaign called Bazta Arpaio aimed at ousting the sheriff. Volunteers knocked on thousands of doors to urge people to vote against Arpaio ― they did not specifically advocate for Penzone ― and held events against him, including a mock-retirement party outside his office.

The Bazta Arpaio campaign was able to build off years of work getting more Latino voters registered, said Alex Gomez, a People United for Justice board member. The group also capitalized on the community’s disdain for Arpaio.

“The vast majority of people that we talk to know that they want to vote against him,” Gomez said. “And they know their reasons ― either their families have been victims, they have been victims of Arpaio’s profiling, or someone from their family was detained or they know someone that was.”

The sheriff’s race got attention from the top of the Democratic ticket, with presidential nominee Hillary Clinton urging voters to dump Arpaio during a rally in Tempe, Arizona, last week.

“I think it’s time you had a new sheriff in town, don’t you?” Clinton asked the crowd.

This post has been updated with vote tallies from the election.