Attorney General Jeff Sessions resigned on Wednesday after months of speculation about his departure.

President Donald Trump has repeatedly criticized Sessions' handling of the Justice Department, particularly related to the investigation into Russia's election interference.

"At your request, I am submitting my resignation," Sessions said in a letter to Trump.

READ MORE: Jeff Sessions' replacement is good news for Trump and bad news for Mueller

Attorney General Jeff Sessions resigned on Wednesday after months of speculation about his departure.

Sessions said in a letter that he was resigning at the request of President Donald Trump.

"Since the day I was honored to be sworn in as Attorney General of the United States, I came to work at the Department of Justice every day determined to do my duty and serve my country," Sessions said in the letter. "I have done so to the best of my ability, working to support the fundamental legal processes that are the foundation of justice."

Sessions also touted the Justice Department's efforts to address crime, immigration, and the opioid crisis, among other issues.

"We have seen results," Sessions wrote.

Matthew Whitaker, Sessions' chief of staff, will take over as acting attorney general, Trump said. A Justice Department representative confirmed that Whitaker would assume supervision of the Russia investigation, led by the special counsel Robert Mueller, from Deputy Attorney General Rod Rosenstein.

Sessions said he resigned at the request of President Donald Trump. Department of Justice

Trump has repeatedly criticized Sessions' handling of the Justice Department, particularly related to the investigation into Russia's election interference. Trump has long made it clear he did not agree with Sessions' decision to recuse himself from the investigation, berating him in an at times brutal public fashion.

Legal experts suggested on Wednesday that though Trump might have fired Sessions to exercise more control over the Russia investigation, the attorney general's ouster may have added yet another piece to a growing obstruction-of-justice case against Trump.

In addition to criticizing Sessions' recusal, Trump has also said that had he known Sessions would step back from overseeing the investigation, he would have picked someone else as attorney general.

Moreover, The New York Times reported earlier this year that Trump once ordered the White House counsel Don McGahn to stop Sessions from recusing himself, and that when McGahn was unsuccessful, Trump erupted in anger, saying he needed Sessions to "protect" and "safeguard" him. The news added another layer to reports that the president once speculated about why "my guys" at the "Trump Justice Department" weren't doing more to shield him from Mueller's scrutiny.

After the special counsel was appointed in May 2017, Trump also channeled his fury toward Sessions, accusing him of "disloyalty."

Sessions' departure came one day after the 2018 midterm elections, which saw Democrats win a majority in the House of Representatives. There is widespread speculation that Democrats will use the changeover as an opportunity to launch new investigations into Trump, which could include looking more closely into his relationship with Russia.

Read more: A defiant Trump sparred with the media and threatened Democrats in a feisty post-midterms press conference

Trump on Wednesday threatened Democrats over the possibility of new investigations, saying he'd take a "warlike posture."

"They can play that game, but we can play it better," Trump said.