The presidents outburst came in the middle of an Oval Office meeting Mr. Trump had with top advisers on May 17, to discuss candidates to take over the F.B.I. after the president fired its director, James B. Comey, earlier that month. In addition to Mr. Sessions, Vice President Mike Pence, Donald F. McGahn III, the White House counsel, and several other aides attended the meeting.
In the middle of the meeting, Mr. McGahn received a phone call from Rod J. Rosenstein, the deputy attorney general who had been overseeing the Russia investigation since Mr. Sessions recused himself from the inquiry months earlier. Mr. Sessions had stepped aside after it was revealed he had not provided accurate testimony to Congress about his meetings with the Russian ambassador during the presidential campaign.
In the telephone call to Mr. McGahn, Mr. Rosenstein said he had decided to appoint Mr. Mueller to be a special counsel for the investigation. Congress had been putting pressure on Mr. Rosenstein to appoint a special counsel to put distance between the Trump administration and the Russia investigation, and just the day before The New York Times had revealed that Mr. Trump had once asked Mr. Comey to end the F.B.I.s investigation into Michael T. Flynn, the former national security adviser.
When the phone call ended, Mr. McGahn relayed the news to the president and his aides. Almost immediately, Mr. Trump lobbed a volley of insults at Mr. Sessions, telling the attorney general it was his fault they were in the current situation. Mr. Trump told Mr. Sessions that choosing him to be attorney general was one of the worst decisions he had made, called him an idiot, and said that he should resign.
An emotional Mr. Sessions told the president he would resign and left the Oval Office. That evening, as the Justice Department publicly announced the appointment of Mr. Mueller, the attorney general wrote a brief resignation letter to the president that was later sent to the White House. A person familiar with the events raised the possibility that Mr. Sessions had become emotional because the impact of his recusal was becoming clear.
In the hours after the Oval Office meeting, however, Mr. Trumps top advisers intervened to save Mr. Sessionss job. Mr. Pence, Stephen K. Bannon, the presidents chief strategist at the time, and Reince Priebus, his chief of staff, all advised that accepting Mr. Sessionss resignation would only sow more chaos inside the administration and rally Republicans in Congress against the president. Mr. Sessions, a former Alabama senator, served in the Senate for two decades.
The president relented, and eventually returned the resignation letter to Mr. Sessions with a handwritten response on it.