WASHINGTON — President Trump forced out Attorney General Jeff Sessions on Wednesday, ending a partnership that soured almost from the start of the administration and degenerated into one of the most acrimonious public standoffs between a commander in chief and a senior cabinet member in modern American history.
Mr. Sessions’s resignation, made at the president’s request, was being delivered to John Kelly, Mr. Trump’s chief of staff. It came just a day after midterm elections in which Democrats captured control of the House, but Republican success in holding onto the Senate and building their slim majority may make it easier for the president to confirm a successor.
“Dear Mr. President, at your request I am submitting my resignation,” Mr. Sessions said in his letter. He added, “Most importantly as my time as attorney general, we have restored and upheld the rule of law,” and thanked the president.
“We thank Attorney General Jeff Sessions for his service, and wish him well!” he wrote. “A permanent replacement will be nominated at a later date.”
The president has regularly attacked the Justice Department and Mr. Sessions, blaming the attorney general for the specter of the special counsel investigation into ties between Mr. Trump’s campaign and Russia.
Mr. Trump has said for months that he wished to replace Mr. Sessions, but lawmakers and administration officials believed that firing the attorney general before the midterm elections would have had negative consequences for Republicans in tight races. So it came as little surprise when Mr. Sessions’s resigned the day after the midterms were over.
Mr. Trump blamed Mr. Sessions for recusing himself from overseeing the investigation in its early stages, leading to the appointment of a special counsel.
“He took the job and then he said, ‘I’m going to recuse myself.’ I said, ‘What kind of a man is this?’” Mr. Trump said this year in a Fox News interview. “I wanted to stay uninvolved. But when everybody sees what’s going on in the Justice Department — I always put ‘justice’ now with quotes.”
The deputy attorney general, now Mr. Rosenstein, would normally be in line to become the acting attorney general, but Mr. Trump has complained publicly about Mr. Rosenstein, too. Since Mr. Sessions is recused from all election-related matters, Mr. Rosenstein oversees the special counsel, Robert S. Mueller III, who is investigating the Trump campaign’s interactions with Russia.
Such a move might clear the way for Mr. Trump to fire Mr. Mueller. To dismiss a special counsel, the president has to order the attorney general or, in the case of a recusal, the deputy attorney general to carry it out. Mr. Rosenstein has said that he sees no justification to dismiss Mr. Mueller. Mr. Trump has already fired James B. Comey, the F.B.I. director originally overseeing the investigation.
In pushing out his attorney general, the president cast aside one of his earliest and strongest supporters.
In February 2016, Mr. Sessions became the first sitting senator to endorse Mr. Trump’s presidential campaign, and in the months leading up to the election, he became one of the candidate’s closest national security advisers.
Only weeks after he was confirmed as the United States’ top law enforcement officer, Mr. Sessions became ensnared in the Russia inquiries that have consumed Mr. Trump’s presidency. He recused himself from overseeing the Justice Department investigation in March 2017, after revelations that he had failed to report encounters with Ambassador Sergey I. Kislyak of Russia during the 2016 campaign.
At the time, Mr. Sessions said there was nothing nefarious about those meetings, although he acknowledged that he “should have slowed down” and been more thoughtful in denying any contacts with Russian officials during his Senate confirmation process. His recusal was one of his first public acts as attorney general.
Mr. Trump has long believed that those who have supported and defended him are most entitled to high-ranking positions in the federal government. Mr. Sessions, in Mr. Trump’s mind, had betrayed that axiom.
In a July 2017 interview with The New York Times, Mr. Trump unexpectedly lashed out at Mr. Sessions.
“Sessions should have never recused himself, and if he was going to recuse himself, he should have told me before he took the job and I would have picked somebody else,” Mr. Trump said. He said Mr. Sessions had given some “bad answers” during his confirmation hearings.
Mr. Trump never forgave Mr. Sessions, and over the next year and a half, his complaints about Mr. Sessions on Twitter and in his public comments became more pointed and insulting. At various points, he called Mr. Sessions “beleaguered,” “VERY weak” and “DISGRACEFUL.” In private, he referred to him derisively as “Mr. Magoo,” after the befuddled cartoon character.
Mr. Trump also publicly badgered Mr. Sessions to open investigations into his defeated rival, Hillary Clinton, and other Democrats, and when Mr. Sessions did not, the president excoriated the attorney general. Critics from both parties said the president was shredding the traditional independence of the law enforcement agencies in seeking what appeared to be politically motivated prosecutions.
For the most part, Mr. Sessions made no public retort. But after the president chided him in February for leaving an inquiry into the F.B.I.’s handling of the Russia investigation to an inspector general rather than conducting his own review, Mr. Sessions pushed back. “As long as I am the attorney general,” he said, “I will continue to discharge my duties with integrity and honor.”
In March, Mr. Sessions said he still believed he did the right thing in recusing himself. “I don’t think the attorney general can ask everybody else in the department to follow the rules if the attorney general doesn’t follow them,” he told Time magazine.
When Mr. Trump said that Mr. Sessions “never took control of the Justice Department,” Mr. Sessions fired back hours later, saying in a rare public rebuke that he “took control of the Department of Justice the day I was sworn in.”
“The Department of Justice,” Mr. Sessions said, “will not be improperly influenced by political considerations.”
Mr. Sessions seemed more aligned with the president when he fired Andrew G. McCabe as deputy director of the F.B.I. barely a day before Mr. McCabe was due to retire, jeopardizing his pension. Mr. Trump for months had publicly berated Mr. McCabe, a Republican, because Mr. McCabe’s wife had run for office as a Democrat with financial support from a friend of Mrs. Clinton’s. In firing him, Mr. Sessions cited an inspector general investigation that found that Mr. McCabe had not been fully candid about his interactions with a reporter, an assertion the former deputy director denied.
Mr. Sessions tried to resign at least twice. In June 2017, shortly after his recusal, Mr. Trump berated Mr. Sessions during a private meeting in the Oval Office and accused him of “disloyalty.” Mr. Sessions grew emotional and agreed to resign. Reince Priebus, then the White House chief of staff, later said he ran out of the building to find the attorney general in the parking lot and stop him from leaving.
Ultimately, Mr. Priebus persuaded Mr. Trump not to accept the resignation. Mr. Priebus said he intervened again to save Mr. Sessions a couple of months later when the president again demanded a resignation. “If I get this resignation,” Mr. Priebus remembered telling Mr. Trump, “you are in for a spiral of calamity that makes Comey look like a picnic.”
As attorney general, Mr. Sessions made a forceful mark on the Justice Department. He rolled back some of President Barack Obama’s signature policies as he encouraged federal prosecutors to pursue the toughest possible charges and sentences against criminal suspects. He successfully advised Mr. Trump to rescind Mr. Obama’s program protecting nearly 700,000 young immigrants who were brought to the country illegally as children. He sued California over its sanctuary laws and targeted states that legalized marijuana.
Mr. Sessions, 71, got his start in politics as a United States attorney in Alabama, but his nomination for a federal judgeship was blocked by the Senate amid charges of racial insensitivity. He mounted a comeback by winning election as the state attorney general and then, in 1996, to the Senate that had once rejected him.