CNN  — 

Joe Arpaio, the former Arizona sheriff known for his controversial hardline tactics against undocumented immigrants, lost his bid to win back his former position in Maricopa County.

Arpaio lost Tuesday’s Republican primary for Maricopa County sheriff to his former chief deputy Jerry Sheridan by about 6,000 votes, according to the results from the Maricopa County Elections Department.

Sheridan will challenge the current Maricopa County Sheriff Paul Penzone, a Democrat and former Phoenix police officer, who ousted Arpaio in 2016.

Arpaio, who calls himself “America’s toughest Sheriff,” was in the post for Maricopa County for 24 years. He gained national notoriety for his treatment of those he held in an infamous outdoor jail known as “Tent City,” where he made people wear pink underwear and work in chain gangs. Critics have said the facility was demeaning for inmates, who stayed in scorching heat.

Arpaio had pledged that his reelection would bring back “Tent City” and some of his most controversial policing tools.

In 2017, Arpaio was found guilty of criminal contempt for ignoring a court order in a racial profiling case by continuing patrols targeting migrants, and faced up to six months in jail.

President Donald Trump issued his first presidential pardon that year to Arpaio, an early Trump supporter — a decision that drew heavy criticism.

Arpaio then attempted a political comeback by running for US Senate in 2018 but lost to Martha McSally in the Republican primary.

After news of his loss, Arpaio told The Arizona Republic that “this will be the last time I run for office.”

Sheridan worked in the Maricopa County Sheriff’s office for 38 years before retiring as chief deputy. He was found in civil contempt in 2016 with connection to the racial profiling case. He was not charged with criminal contempt due to the statute of limitations.

CNN’s Jennifer Henderson, Paul Le Blanc, Carma Hassan and Darran Simon contributed to this report.