Months before President Trump issued his Friday-night pardon of Joe Arpaio, the former Arizona sheriff, the president asked his attorney general and White House counsel whether the case could be dropped altogether, according to four administration officials familiar with the discussion.

During a wide-ranging meeting, the officials said, Mr. Trump asked both Jeff Sessions, the attorney general, and Donald F. McGahn II, the White House counsel, what the options were for helping Mr. Arpaio, a longtime supporter who had been charged with defying a court order directing him to stop detaining people solely on the suspicion that they were undocumented immigrants.

Mr. McGahn and Mr. Sessions both promptly told the president that the case could not be dropped and the charges wiped away, according to the officials, who spoke on the condition of anonymity because they were not authorized to speak publicly about Mr. Trump’s private conversations. Mr. Trump then asked about other options, including his power to pardon Mr. Arpaio if he was convicted. He was told he had broad pardon powers, and was satisfied with that answer, the officials said. Mr. Arpaio was ultimately convicted last month, and Mr. Trump pardoned him before he was sentenced.

Sarah Huckabee Sanders, the White House press secretary, appeared to acknowledge that a conversation had taken place, saying in a statement: “It’s only natural the president would have a discussion with administration lawyers about legal matters. This case would be no different.” A spokesman for the Justice Department declined to comment about the exchange, which was first reported by The Washington Post.

Since taking office, Mr. Trump has often been indifferent to the notion of separation of powers: He has railed against a congressional leader over an inquiry into possible collusion between his campaign and Russian officials, and he has said he dismissed the head of the F.B.I., James B. Comey, over his handling of a related investigation.

But his pardon of Mr. Arpaio, 85, who became a lightning rod for controversy over his anti-immigrant views and accusations that he racially profiled Latinos, has prompted a fresh round of criticism, even from one of the top members of his own party.

On Saturday, the House speaker, Paul D. Ryan of Wisconsin, called the president’s action a misuse of pardon power that sent a dangerous signal.

Mr. Ryan “does not agree with this decision,” a spokesman, Doug Andres, said in a statement. “Law enforcement officials have a special responsibility to respect the rights of everyone in the United States. We should not allow anyone to believe that responsibility is diminished by this pardon.”

Mr. Trump ran on a message of curtailing immigration, and his message dovetailed with Mr. Arpaio’s. Republicans who were caught by surprise by Mr. Trump’s victory have been grappling with how to stand up against racism while making sure they do not alienate the older, whiter demographic of the party’s base.

Senator John McCain, Republican of Arizona, said that the president’s pardon “undermines his claim for the respect of rule of law, as Mr. Arpaio has shown no remorse for his action.” The state’s other Republican senator, Jeff Flake, who has been attacked by Mr. Trump and who is facing a primary challenge, was more muted.

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

Representative Trent Franks, another Arizona Republican, said he saw it as a just end to the saga of Mr. Arpaio’s legal entanglements.

“The president did the right thing — Joe Arpaio lived an honorable life serving our country, and he deserves an honorable retirement,” Mr. Franks posted on Twitter.

Outside Arizona, most Republicans stayed quiet. But Democrats laced into the president.

Jesse Lehrich, a spokesman for Organizing for Action, the political group that grew out of President Barack Obama’s campaigns, said the pardon “signals a disturbing tolerance for those who engage in bigotry.”

He added: “It sends an unsettling message to immigrants across the country. And it’s a repudiation of the rule of law. As a massive hurricane is hurtling toward the southern United States, the White House is focused not on saving lives, but on pardoning a man who committed unlawful acts of racial discrimination.”

The White House announced the pardon amid preparations for the storm, but the federal government said it was on top of the looming natural disaster.

Mr. Arpaio had become a staple of cable television for his roundups of people suspected of being in the country illegally in his heavily Latino state. After the Republicans lost the 2012 presidential election, the Republican National Committee conducted what came to be known as an election autopsy on what went wrong. The report concluded that the party needed to promote comprehensive immigration reform and do better outreach to Hispanics — guidance that Mr. Trump tossed aside during his campaign.

Many presidents have issued controversial pardons. Gerald R. Ford pardoned Richard M. Nixon. Bill Clinton pardoned Marc Rich, one of his donors, in his final days in office. By definition, pardons absolve someone of having broken the law.

But Mr. Arpaio had long been accused of abuses against minorities, including repeated violations of Fourth Amendment protections against unreasonable searches and seizures. His pardon struck a different political chord.

Paul Begala, a Democratic strategist who advised the main “super PAC” supporting Hillary Clinton in 2016, suggested that Mr. Trump was offering a different type of signal — one to people who might be approached by Robert S. Mueller III, the special counsel investigating ties between the Trump campaign and Russia, as well as possible obstruction of justice by the president when he fired Mr. Comey.

“The Arpaio pardon was awful in and of itself, but I also think it was a signal to the targets of the Mueller investigation that ‘I got your back,’” Mr. Begala said on Bill Maher’s HBO program on Friday night.

Mr. Arpaio was an early admirer of Mr. Trump. He appeared with him at a rally in Phoenix in 2015, and he vocally supported Mr. Trump’s interest in raising false questions about whether Mr. Obama, the first black president, was born in the United States.

Ari Fleischer, who was a press secretary under President George W. Bush, said that pardoning Mr. Arpaio did not “break new ground” in a decades-long debate over immigration.

But, echoing Mr. Begala, he said the concern was the message it sent to others who might receive pardons.

He said Mr. Bush used to wonder why presidents had the pardon power to begin with. “It does strike me as a constitutional anachronism,” Mr. Fleischer said.

“One should not be able to break the law thinking they have a protector in chief,” he added. “If mischief is connected to the White House and the president can pardon those who engaged in that activity, it leads to unlimited power.”

Correction:

An earlier version of this article misstated the clemency that President Barack Obama gave to Chelsea Manning, the soldier who leaked national security information. Mr. Obama commuted Ms. Manning’s prison sentence, but did not issue a pardon.

A version of this article appears in print on , on Page A18 of the New York edition with the headline: Trump Asked Months Ago if Arpaio Case Could Be Dropped, Officials Say. Order Reprints | Today’s Paper | Subscribe