Attorney General William Barr will leave his position this month, President Donald Trump said in a tweet Monday.
The news comes not long after Barr said there was no widespread fraud in the election, defying Trump, who has made baseless claims the basis of a failed legal bid to overturn the results and stay in power.
"Just had a very nice meeting with Attorney General Bill Barr at the White House," Trump tweeted. "Our relationship has been a very good one, he has done an outstanding job! As per letter, Bill will be leaving just before Christmas to spend the holidays with his family."
Download the NBC News app for breaking news and politics
Barr "resigned on his own accord" and "wasn't pushed out or forced to resign," a White House official said. The official described Barr's afternoon meeting with Trump as "very amicable."
Trump named Deputy Attorney General Jeff Rosen as acting attorney general to serve in the remaining weeks of his term. President-elect Joe Biden, who will be sworn in Jan. 20, has not announced his pick for attorney general.
Barr took over the role after Trump clashed with his previous attorney general, Jeff Sessions, over the Russia investigation, which Barr referred to as the "nadir" of his tenure in his resignation letter to Trump.
"I am greatly honored that you called on me to serve your Administration and the American people once again as Attorney General. I am proud to have played a role in the many successes and unprecedented achievements you have delivered for the American people," he said.
He later added, "The nadir of this campaign was the effort to cripple, if not oust your administration with frenzied and baseless accusations of collusion with Russia."
Barr, who also served as attorney general for President George H.W. Bush, is only the second person to have held the job twice. John Crittenden was the first, in the 19th century. Barr was confirmed by the Senate in 2019, 54-45.
Despite his reputed loyalty to Trump, Barr in recent months found himself in the president's crosshairs. Trump has praised and criticized Barr in interviews, and he has used the Justice Department as a cudgel to go after perceived political enemies.
Trump over the weekend lashed out on Twitter following media reports that Barr had instructed officials to prevent word of investigations into Hunter Biden from becoming public in the weeks leading up to the November election.
In October, Trump said he was "not happy" with Barr after the Justice Department's investigation of the Obama administration found no wrongdoing and quietly concluded with no criminal charges, and he declined to say whether he would keep Barr on for a potential second term.
But Democrats have long accused Barr of acting as Trump's personal attorney rather than as an independent official. He has been lambasted for undercutting the conclusions of the Mueller investigation, directing federal prosecutors to abandon their prosecution of ex-national security adviser Michael Flynn and repeating Trump's baseless claims about mail-in voting.