"Just had a very nice meeting with Attorney General Bill Barr at the White House. 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," Trump tweeted.
Trump said Deputy Attorney General Jeff Rosen will become Acting Attorney General after Barr departs on Dec. 23. Richard Donoghue will become Deputy Attorney General, the president tweeted.
In his resignation letter, however, Barr praised the president and said Trump was the victim of constant partisan attacks.
"I am greatly honored that you called on me to serve your Administration and the American people once again as Attorney General," Barr wrote in the letter. "Your record is all the more historic because you accomplished it in the face of relentless, implacable resistance."
Barr's letter also praised Trump for his handling of the COVID-19 vaccine, border security, and China.
The announcement follows news last week that Barr deliberately sought to prevent any public disclosure during the presidential election of a federal investigation into potential tax violations by President-elect Joe Biden's son Hunter.
Sources familiar with the matter told ABC News that the investigation, which was initiated in the U.S. attorney's office in Delaware in 2018, was put on pause as the Democratic primaries and general election campaigns played out -- in line with a longstanding Justice Department policy intended to prevent overt investigative actions that might impact elections. The investigation began prior to Barr taking office in January 2019.
Trump has repeatedly vented his frustration with Barr in recent weeks as Barr declined to involve the Justice Department in Trump's unsuccessful legal efforts to overturn his election loss.
In an interview with The Associated Press in early December, Barr said that while the department was investigating specific complaints of possible voter fraud, "to date, we have not seen fraud on a scale that could have effected a different outcome in the election."
Asked days later about Barr's comments during an appearance in the Oval Office, Trump declined to say whether he still had confidence in the attorney general, telling reporters, "ask me that in a number of weeks from now."
Barr had also told associates in recent weeks that he was considering resigning from his post prior to Biden's inauguration, believing he had completed what he intended to accomplish at the department, according to sources.
Barr's tenure was marked with controversy over repeated instances where Barr wielded the Justice Department in ways that advanced Trump's personal and political interests. His four-page summary of special counsel Robert Mueller's report outlining Russia's interference in the 2016 election and episodes of potential obstruction of justice by President Trump infuriated Democrats and prosecutors on Mueller's team, who accused him of misrepresenting Mueller's findings to dampen the political impact on Trump.
Appearing defiant in his belief that Trump was unfairly targeted by politically-motivated officials in the FBI, Barr ordered investigations into the origins of the Russia probe, including an ongoing inquiry by U.S. attorney John Durham, whom Barr recently appointed as a special counsel -- likely ensuring that Durham's review will continue into Biden's tenure.
While Durham has indicted one former FBI lawyer who pleaded guilty to altering a document used to secure surveillance of a former Trump campaign aide, it's unclear whether he has uncovered any other possible criminal conduct. An extensive review by the DOJ's inspector general released last year declared that the Russia investigation was launched with proper cause despite missteps by some of the FBI officials involved.
In other instances, Barr was accused of acting more like the president's personal attorney as he intervened in criminal cases involving Trump's allies.
In February, Barr's reversal of a sentencing recommendation for Trump ally and self-described "dirty trickster" Roger Stone, who had been convicted on witness tampering and obstruction of justice charges in Mueller's investigation, prompted four career prosecutors to quit the case -- with one resigning from the department altogether.
Barr also sought to drop the criminal case against former national security adviser Michael Flynn, who had twice pleaded guilty to lying to the FBI about his contacts with the former Russian ambassador. Barr argued FBI agents acted improperly in their investigation of Flynn and that his lies were not "material" to any legitimate investigation.
After Flynn was extended a full pardon by Trump last month, a federal judge, in the process of formally dismissing the case, said he had reason to suspect the Justice Department's motives.
"As this case has progressed, President Trump has not hidden the extent of his interest in this case," said U.S. District Judge Emmet Sullivan, pointing to Trump's public comments and tweets venting about how Flynn was treated. "Given this context, the new legal positions the government took ... raise questions regarding its motives in moving to dismiss."
In both the Flynn and Stone cases, Barr denied he was acting at the behest of Trump or the White House.
Having previously served as attorney general to President George H.W. Bush, Barr has been a major proponent of strengthening the power of the presidency, seeking to empower political appointees at the FBI and DOJ to exert more control over career officials.
Increasingly throughout his tenure, Barr was lambasted by critics over what they argued was his blatant politicization of the department. In speeches and interviews he repeatedly defended Trump and cast him as a victim of a lawless "resistance" unwilling to accept the results of the 2016 election.
Over the summer, Barr dispatched federal law enforcement officers across the country as Trump publicly called for police to forcefully crack down on rioters damaging property and clashing with authorities following the death of George Floyd -- even ordering the dispersal of a crowd of peaceful protesters gathered near the White House to make way for Trump to stage a photo-op at a nearby church.
And before his most recent statements confirming the department had uncovered no widespread fraud that could overturn the results of the 2020 election, during the COVID-19 pandemic Barr was among those repeatedly pushing conspiracies about foreign countries being able to mail in millions of ballots to the U.S. -- though when pushed by CNN for evidence to support those claims, he did not provide any and said it was common sense that they would attempt to do so.
It's unclear what Barr's next steps will be once outside of government. Prior to joining the administration, Barr had become a multi-millionaire in his position as general counsel for GTE corporation and its successor, Verizon.