President Trump pardoned former Maricopa County, Ariz., sheriff Joe Arpaio Aug. 25. Here’s what you need to know. (Patrick Martin,Victoria Walker/The Washington Post)

President Trump pardoned former Maricopa County, Ariz., sheriff Joe Arpaio Aug. 25. Here’s what you need to know. (Patrick Martin,Victoria Walker/The Washington Post)

President Trump on Friday pardoned former Arizona sheriff Joe Arpaio — a move that keeps one of his staunchest political allies out of jail and will likely cheer his conservative base, which supports both men’s hard-line views on illegal immigration.

The unusual pardon — coming less than a month after Arpaio was convicted, and before his planned October sentencing — will further anger the president’s critics and is likely to worsen the president’s already tense relationship with the judicial branch, which he has repeatedly criticized.

A pardon is perhaps the only way to make Arpaio — a longtime county sheriff who gained national fame and notoriety for his aggressive pursuit of undocumented immigrants — a more polarizing figure than he already is.

The decision on Arpaio is the latest chapter in a line of historically controversial pardons granted by presidents — rare but not unprecedented uses of power that draw fire for being politically or personally motivated. ­Legal experts have compared an Arpaio pardon to the one President George H.W. Bush granted to former defense secretary Caspar Weinberger in 1992 over the Iran-contra affair, or the one President Clinton granted to fugitive financier Marc Rich in 2001.

[Pardon for Arpaio would be rare but not unprecedented act]

In this Dec. 18, 2013, photo, then-Maricopa County (Ariz.) Sheriff Joe Arpaio speaks at a news conference in Phoenix. President Trump has pardoned the former sheriff following his conviction for criminal contempt of court for intentionally disobeying a judge’s order in an immigration case. (Ross D. Franklin/AP)

But Arpaio’s pardon — the first of the Trump presidency — is a rarity among rarities. In recent decades, presidents have tended to issue controversial pardons at the end of their terms, not the beginning. The move raises questions about how often the president might pardon other political figures — and for what types of offenses.

In a statement announcing the pardon, Trump made no mention of Arpaio’s offense — criminal contempt of court — but praised his past military service.

“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,” Trump 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,” the statement continued.

Arpaio’s lawyer, Jack Wilenchik, said simply: “Justice has been done.’’

In a tweet, Arpaio thanked the president “for seeing my conviction for what it is: a political witch hunt by holdovers in the Obama justice department!’’

Arpaio told the Associated Press that he appreciates the president’s action and will always stand by him. He said he will speak more about the matter next week.

Joe Arpaio's illegal-immigration crackdown made him a polarizing figure and an early ally of President Trump. (Meg Kelly/The Washington Post)

The sheriff’s critics spent years trying to stop the police practices that Arpaio sanctioned and that they charge were discriminatory and abusive; in recent weeks, they had vociferously objected to the pardon that Trump repeatedly hinted was coming.

A deputy legal director of the American Civil Liberties Union called the pardon “a presidential endorsement of racism.’’

“Trump has chosen lawlessness over justice, division over unity, hurt over healing,’’ said Cecillia Wang, the ACLU official. “Once again, the president has acted in support of illegal, failed immigration enforcement practices that target people of color and have been struck down by the courts.’’

The president traveled this week to Phoenix, where he suggested at a rally that he was on the verge of pardoning Arpaio, but said he would not do it that night because it would be “controversial.’’

Earlier this month, the president told Fox News he was “seriously considering’’ a pardon for Arpaio, who was convicted last month of criminal contempt for ignoring a federal judge’s order to stop detaining people because he merely suspected them of being undocumented immigrants.

Trump called Arpaio a “great American patriot” who had “done a lot in the fight against illegal immigration. . . . He has protected people from crimes and saved lives. He doesn’t deserve to be treated this way.”

[Joe Arpaio’s record on illegal immigration]

Trump’s pardon came late on a Friday night, at a time when much of the country was focused on a Category 4 hurricane bearing down on Texas.

The reaction among advocates and Democrats was swift.

“President Trump is a coward. He waited until a Friday evening, as a hurricane hits, to pardon a racist ex-sheriff,” said Rep. Ruben Gallego (D-Ariz.), who represents Phoenix. “Trump should at least have the decency to explain to the American public why he is undermining our justice system.”

Sen. Charles E. Schumer (D-N.Y.) also accused the president of “using the cover of the storm to pardon a man who violated a court’s order.”

Normally, pardon applications are submitted to the Justice Department, where they are scrutinized over a period of months before recommendations are made to the White House. Some applicants wait years to find out whether they will receive pardons or clemency.

Arpaio’s pardon came much faster, and it was not subject to a Justice Department review, according to officials.

Arpaio’s sentencing was scheduled for Oct. 5, and he had faced up to six months in prison.

Vanita Gupta, chief executive of the Leadership Conference on Civil and Human Rights, said the president has “yet again damaged himself, the rule of law, and our country tonight. This pardon sends a dangerous message that a law enforcement officer who abused his position of power and defied a court order can simply be excused by a president who himself clearly does not respect the rule of law.’’

Arpaio’s lawyer has maintained that the prosecution of Arpaio was a political vendetta against a foe of the Obama administration and that therefore the political act of a pardon was a fair and just way to end the case.

Arpaio, the former sheriff of Maricopa County, Ariz., has long been an advocate for Trump and spoke in support of him at the Republican National Convention in July 2016. The men seem to have the same views on illegal immigrants and the use of harsh tactics against criminals or suspected criminals. Arpaio is well known in part for forcing his inmates to wear pink underwear and sleep outdoors in his Tent City Jail.

The legal saga surrounding Arpaio dates back years. In 2011, as part of a lawsuit, the then-sheriff was enjoined by U.S. District Judge G. Murray Snow from detaining people he thought to be illegal immigrants, when they were not charged with any other crime. Prosecutors alleged that Arpaio continued to do so, and last year, the Justice Department decided to pursue a criminal contempt-of-court case against him.

Critics said that his policy of detaining people on mere suspicion was racist and illegal, and that his refusal to honor a court’s order to stop was brazen. Arpaio’s lawyers argued that the judge’s order enjoining their client’s conduct was “not clear,” and they suggested that Arpaio was merely doing what others do routinely: turning over those in the country illegally to the U.S. Border Patrol.