WASHINGTON — President Donald Trump on Friday pardoned former sheriff Joe Arpaio, the retired Arizona lawman who was convicted for intentionally disobeying a judge’s order in an immigration case.

The White House said the 85-year-old ex-sheriff of Arizona’s Maricopa County was a “worthy candidate” for a presidential pardon.

The action came several days after Trump, at a rally in downtown Phoenix, strongly hinted that he intended to issue a pardon.

“So was Sheriff Joe was convicted for doing his job?” Trump asked supporters. “I’ll make a prediction. I think he’s going to be just fine, OK.”

Arpaio, who became linked to Trump during the campaign for their hardline immigration views, was convicted of a misdemeanor for intentionally defying a judge’s order to stop his traffic patrols that targeted immigrants.

Both politicians questioned the authenticity of then-President Barack Obama’s birth certificate and have a similar history in sparring with judges.

In the statement Friday night, the White House said, “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 eighty-five years old, and after more than fifty years of admirable service to our Nation, he is worthy candidate for a Presidential pardon.”

Longtime critics of the retired sheriff say a pardon would remove the last chance at holding Arpaio legally accountable for a long history of misconduct during his 24 years as metro Phoenix’s top law enforcer. They also cited allegations that Arpaio retaliated against his political foes and other alleged misconduct.

“They have been after me for years,” Arpaio said earlier this week. “The same people. What’s new?”

Here is a look at some of Arpaio’s legal issues over the years:

Investigating foes

Arpaio has a reputation for investigating officials who cross him in legal or political disputes.

Maricopa County paid $8.7 million to settle lawsuits filed by county officials who claimed Arpaio had launched criminal investigations against them on trumped-up allegations.

The disputes centered on cuts to agency budgets, a plan to build a new court complex and other issues. Donahoe, who in the end won a $1.2 million settlement, drew the sheriff’s ire by disqualifying a prosecutor who was an Arpaio ally from an investigation into the construction of a court building in downtown Phoenix.

Donahoe and two county officials were charged with crimes but their cases were dismissed.

A federal grand jury conducted a nearly three-year investigation of Arpaio’s office on criminal abuse-of-power allegations, specifically examining the investigative work of the sheriff’s anti-public corruption squad.

But the federal investigation was closed in September 2012 without any charges being filed. He was re-elected two months later.

Racial profiling

Arpaio was convicted in July of misdemeanor contempt of court for disobeying a judge’s order to stop his immigration patrols that targeted immigrants.

The conviction stems from a civil rights case in which Arpaio’s officers were found to have racially profiled Latinos in his patrols.

Arpaio faced many other allegations of wrongdoing in the profiling case that didn’t result in criminal charges.

He was accused of ordering some immigration patrols not based on reports of crime but rather on letters from Arizonans who complained about people with dark skin congregating in an area or speaking Spanish.

His office acknowledged throwing away or shredding some traffic-stop records during immigration patrols.

Traffic-stop videos that the sheriff’s office had failed to turn over to opposing lawyers were discovered nearly two years after the trial concluded.

After some videos were discovered at the home of a sheriff’s deputy who was charged in a drug case, the sheriff’s office bungled a plan to gather the recordings from officers. That led the judge to voice concerns that some officers may have destroyed unflattering videos.

And Arpaio was accused of investigating the judge who ruled against him in the profiling case — an allegation the sheriff vigorously denied.

Botched investigations

Arpaio spent years trying to cultivate an image as a law enforcer who was tough on criminals.

But that reputation was undermined when his office failed to adequately investigate more than 400 sex-crimes cases, including dozens of child molestation reports, over a three-year period ending in 2007.

The sheriff, who dismissed the controversy about the botched cases as “old history,” apologized in December 2011 for mishandling the cases, and his office has since said it moved to clear up the cases and taken steps to prevent the problem from happening again.

An internal review attributed the failures to understaffing and mismanagement, including hundreds of pieces of evidence intended for storage that were instead left in offices or taken home by detectives. A former supervisor says her investigators were pulled away from time to time to help with training efforts and Arpaio’s immigrant-smuggling squad.

Officials agreed in 2015 to pay $3.5 million to settle a lawsuit that alleged Arpaio botched the investigation into the rape of a 13-year-old girl and failed to arrest the suspect who then went on to attack her again.

Legal costs

Maricopa County spent $141 million defending Arpaio against lawsuits.

That includes $54 million in the racial profiling case alone and $82 million in judgments, settlements and legal fees for the sheriff’s office, covering issues such as lawsuits over deaths in his jails and the lawman’s failed investigations of political enemies.

County officials said Arpaio has never had to pay judgments, settlement costs and legal fees in lawsuits directly connected to his official duties as sheriff.

Here is the official White House statement:

“Today, President Donald J. Trump granted a Presidential pardon to Joe Arpaio, former Sheriff of Maricopa County, Arizona. 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. After serving in the Army, Arpaio became a police officer in Washington, D.C. and Las Vegas, NV and later served as a Special Agent for the Drug Enforcement Administration (DEA), formerly the Bureau of Narcotics. After 25 years of admirable service, Arpaio went on to lead the DEA’s branch in Arizona.

“In 1992, the problems facing his community pulled Arpaio out of retirement to return to law enforcement. He ran and won a campaign to become Sheriff of Maricopa County. 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 eighty-five years old, and after more than fifty years of admirable service to our Nation, he is worthy candidate for a Presidential pardon.”