Republican presidential candidate Donald Trump is joined onstage by Maricopa County Sheriff Joe Arpaio (L) at a campaign rally in Marshalltown, Iowa January 26, 2016, after Arpaio endorsed Trump.

President Donald Trump is under fire for pardoning the former Phoenix Sheriff Joe Arpaio on Friday.

Arpaio, 85, who served as sheriff of Maricopa County for 24 years, was convicted of criminal contempt of court for defying a judge's orders that he stop arresting immigrants on the suspicion that they were in the U.S. illegally.

Trump announced the pardon Friday night, just as the Texas Gulf Coast was bracing for impact from Category 4 Hurricane Harvey.

The president, whose approval rating is at historic lows, was quickly criticized on Twitter by Democrats in Congress.

tweet

tweet

Sally Yates, the former acting U.S. attorney general whom Trump fired earlier this year, tweeted that the pardon "reveals his own contempt for our Constitution."

Yates tweet

But the president also heard criticism from lawmakers in his own party. Arizona Republican Sen. John McCain, frequently a thorn in Trump's side, was among the most vocal critics. Trump pardoning the sheriff "undermines his claim for the respect of rule of law," McCain tweeted.

tweet

Jeff Flake, McCain's fellow Republican Arizona senator and a frequent target of Trump's ire, also took issue with the decision:

Flake tweet

The Arizona Republic, the largest newspaper in Arpaio's home state, denounced the pardon, saying it placed the former sheriff in "the pantheon of those who see institutional racism as something that made America great."

The pardon "elevated the disgraced former Maricopa County sheriff to monument status among the immigration hardliners and nationalists in Trump's base," wrote the editorial board. "This erases any doubt about whether Trump meant to empower them after the violence in Charlottesville."

The newspaper's editorial board has been critical of Trump before. Last year, it backed Hillary Clinton in the general election, the first time it endorsed a Democrat for president during the paper's 125-plus-year history.

Meanwhile, Arizona governor Doug Ducey and congressman Andy Biggs said they supported the presidential pardon. Ducey said in a statement that Arpaio "deserves credit for helping to reduce crime in Maricopa County over his long career in law enforcement and public office."

As for the residents of Arizona, only 21 percent were in support of the pardon, according to a survey from last week.

The Associated Press and CNBC's Mike Calia contributed to this report.