US President Donald Trump has pardoned Arizona sheriff Joe Arpaio, who had been convicted of criminal contempt.
Mr Arpaio, 85, was found guilty after he defied a court order to stop traffic patrols targeting suspected immigrants. He was due to be sentenced in October.
The president had hinted at the pardon at a rally in Phoenix on Tuesday.
Thanking the president, Mr Arpaio said his conviction was "a political witch hunt by holdovers in the Obama justice department".
"Thank you ... for seeing my conviction for what it is," tweeted Mr Arpaio.
"I'm not going away," he said, while declining to say whether he would run for sheriff again.
Mr Trump has frequently praised the sheriff who is known for his controversial hard-line stance on immigration.
Mr Arpaio frequently appeared on the campaign trail with Mr Trump in 2016.
Who is Joe Arpaio?
"Arpaio's life and career, which began at the age of 18 when he enlisted in the military after the outbreak of the Korean War, exemplify selfless public service," Mr Trump said in a statement.
"Throughout his time as sheriff, Arpaio continued his life's work of protecting the public from the scourges of crime and illegal immigration.
"Sheriff Joe Arpaio is now 85 years old, and after more than 50 years of admirable service to our nation, he is a worthy candidate for a presidential pardon."
Joe Arpaio, who styled himself as "America's toughest sheriff", rose to national prominence for his sweeps of undocumented immigrants in Hispanic communities, and for detaining Spanish-speakers under suspicion of being undocumented migrants.
But the policeman was found guilty of violating a 2011 order to stop detaining migrants.
He frequently appeared on the campaign trail with Mr Trump and was among his earliest supporters - describing him as "the law-and-order candidate".
Mr Arpaio, born in Springfield, Massachusetts, could have faced six months in jail at his sentencing in October.
He served in the US military before he became a police officer - where he quickly acquired a reputation for his anti-immigration stance and tough enforcement tactics.
Mr Arpaio famously forced the prisoners to wear pink underwear and socks and old-fashioned black-and-white striped prison jumpsuits. The inmates lived outdoors while enduring sweltering Arizona desert temperatures.
He also revived chain gangs, including a voluntary one for female prisoners.
- BBC