Sessions told the president in a one-page letter that he was submitting his resignation "at your request."
Trump announced in a tweet that he was naming Sessions' chief of staff Matthew Whitaker, a former United States attorney from Iowa, as acting attorney general.
We are pleased to announce that Matthew G. Whitaker, Chief of Staff to Attorney General Jeff Sessions at the Department of Justice, will become our new Acting Attorney General of the United States. He will serve our Country well....— Donald J. Trump (@realDonaldTrump) November 7, 2018
The resignation was the culmination of a toxic relationship that frayed just weeks into the attorney general's tumultuous tenure, when he stepped aside from the investigation into potential coordination between the president's Republican campaign and Russia.
Trump blamed the decision for opening the door to the appointment of special counsel Robert Mueller, who took over the Russia investigation and began examining whether Trump's hectoring of Sessions was part of a broader effort to obstruct justice and stymie the probe.
The implications for Mueller's investigation were not immediately clear. The Justice Department did not announce a departure for Deputy Attorney General Rod Rosenstein, who appointed Mueller more than a year and a half ago and has closely overseen his work since then.
RELATED: Jeff Sessions and other notable Trump resignations, firings
The relentless attacks on Sessions came even though the Alabama Republican was the first U.S. senator to endorse Trump and despite the fact that his crime-fighting agenda and priorities - particularly his hawkish immigration enforcement policies - largely mirrored the president's.
But the relationship was irreparably damaged in March 2017 when Sessions, acknowledging previously undisclosed meetings with the Russian ambassador and citing his work as a campaign aide, recused himself from the Russia investigation.
The decision infuriated Trump, who repeatedly lamented that he would have never selected Sessions if he had known the attorney general would recuse. The recusal left the investigation in the hands of Rosenstein, who appointed Mueller as special counsel two months later after Trump fired then-FBI Director James Comey.
The rift lingered for the duration of Sessions' tenure, and the attorney general, despite praising the president's agenda and hewing to his priorities, never managed to return to Trump's good graces.
The deteriorating relationship became a soap opera stalemate for the administration. Trump belittled Sessions but, perhaps following the advice of aides, held off on firing him. The attorney general, for his part, proved determined to remain in the position until dismissed. A logjam broke when Republican senators who had publicly backed Sessions began signaling a willingness to consider a new attorney general.
In attacks delivered on Twitter, in person and in interviews, Trump called Sessions weak and beleaguered, complained that he wasn't more aggressively pursuing allegations of corruption against Democratic rival Hillary Clinton and called it "disgraceful" that Sessions wasn't more serious in scrutinizing the origins of the Russia investigation for possible law enforcement bias - even though the attorney general did ask the Justice Department's inspector general to look into those claims.
The broadsides escalated in recent months, with Trump telling a television interviewer that Sessions "had never had control" of the Justice Department and snidely accusing him on Twitter of not protecting Republican interests by allowing two GOP congressmen to be indicted before the election.
Sessions endured most of the name-calling in silence, though he did issue two public statements defending the department, including one in which he said he would serve "with integrity and honor" for as long as he was in the job.
The recusal from the Russia investigation allowed him to pursue the conservative issues he had long championed as a senator, often in isolation among fellow Republicans.
He found satisfaction in being able to reverse Obama-era policies that he and other conservatives say flouted the will of Congress, including by encouraging prosecutors to pursue the most serious charges they could and by promoting more aggressive enforcement of federal marijuana law. He also announced media leak crackdowns, tougher policies against opioids and his Justice Department defended a since-abandoned administration policy that resulted in parents being separated from their children at the border.
His agenda unsettled liberals who said that Sessions' focus on tough prosecutions marked a return to failed drug war tactics that unduly hurt minorities and the poor, and that his rollbacks of protections for gay and transgender people amount to discrimination.
Some Democrats also considered Sessions too eager to do Trump's bidding and overly receptive to his grievances.
Sessions, for instance, directed senior prosecutors to examine potential corruption in a uranium field transaction that some Republicans have said may have implicated Clinton in wrongdoing and benefited donors of the Clinton Foundation. He also fired one of the president's primary antagonists, former FBI deputy director Andrew McCabe, just before he was to have retired - a move Trump hailed as a "great day for democracy."
Despite it all, Sessions never found himself back in favor with the president.
Their relationship wasn't always fractured. Sessions was a close campaign aide, attending national security meetings and introducing him at rallies in a red "Make America Great Again" hat.
But the problems started after he told senators during his confirmation hearing that he had never met with Russians during the campaign. The Justice Department, responding to a Washington Post report, soon acknowledged that Sessions had actually had two encounters during the campaign with the then-Russian ambassador. He recused himself the next day, saying it would be inappropriate to oversee an investigation into a campaign he was part of.
The announcement set off a frenzy inside the White House, with Trump directing his White House counsel to call Sessions beforehand and urge him not to step aside. Sessions rejected the entreaty. Mueller's team, which has interviewed Sessions, has been investigating the president's attacks on him and his demands to have a loyalist in charge of the Russia investigation.
Sessions had been protected for much of his tenure by the support of Senate Republicans, including Judiciary Committee Chairman Chuck Grassley, who had said he would not schedule a confirmation hearing for another attorney general if Trump fired him.
But that support began to fade, with Grassley suggesting over the summer that he might have time for a hearing after all.
And Republican Sen. Lindsey Graham, another Judiciary Committee member who once said there'd be "holy hell to pay" if Trump fired Sessions, called the relationship "dysfunctional" and said he thought the president had the right after the midterm to select a new attorney general.