President Trump granted a pardon to Joe Arpaio, the former sheriff of Maricopa County, Ariz., on Friday.

Arpaio, 85, was previously found guilty of misdemeanor criminal contempt for defying a judge’s order to stop patrols that reportedly targeted immigrants, reported Fox News. His ordered patrols lasted 17 months after the judge’s order.

Arpaio acknowledged extending the patrols, but insisted it wasn’t intentional, blaming one of his former attorneys for not properly explaining the importance of the court order and brushing off the conviction as a “petty crime.”

He would have been sentenced Oct. 5. The offense held a possible jail sentence of six months.

“Sheriff Joe Arpaio is now 85 years old, and after more than 50 years of admirable service to our Nation, he is worthy candidate for a Presidential pardon,” the White House said in a statement.

“I am pleased to inform you that I have just granted a full Pardon to 85 year old American patriot Sheriff Joe Arpaio,” the president tweeted on Friday night. “He kept Arizona safe!”

Arpaio thanked Trump in an earlier tweet, saying that his conviction was the result of a “political witch hunt by holdovers in the Obama justice department.”

“Sheriff Joe” was known for his controversial takes on many issues, including his “birther” campaign against former President Barack Obama and for housing inmates in desert tent camps. Yet he is best known for his approach to battling illegal immigration.

In 2009 Arpaio said his agency arrested 30,000 illegal immigrants since starting his efforts in 2005.

At a rally in Phoenix, on Tuesday, the president asked supporters in the crowd if Arpaio was “convicted for doing his job?”

The crowd cheered.

“He should have had a jury, but I’ll make a prediction: He’ll be just fine,” Trump said. “But I won’t do it tonight, because I don’t want to cause any controversy.”

“We’ll see what happens,” Arpaio said amid discussion of the pardon.

“[I]t doesn’t matter because I’m still going to support him as long as he is the president of the United States because that’s the way I am,” Arpaio said. “I don’t desert for political reasons. I’ll stick with him.”

But Sen. Jeff Flake, R-Ariz., who has had a public feud with Trump in recent weeks, did not support the move.

“Regarding the Arpaio pardon,” Flake wrote on Twitter. “I would have preferred that the President honor the judicial process and let it take its course.”

Arpaio was a staunch support of Trump during the presidential campaign. The president also invoked Arpaio’s name as he called for tougher immigration enforcement.

Arpaio appeared for Trump at rallies in Iowa, Nevada and Arizona, including a huge gathering in the affluent Phoenix suburb where the sheriff lives. Arpaio also gave a speech at the Republican National Convention in which he said Trump would prevent immigrants from sneaking into the country.