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.