Trump said in a tweet that Mattis’s deputy, Patrick Shanahan, will serve as acting Pentagon chief.

“Patrick has a long list of accomplishments while serving as Deputy, & previously Boeing,” Trump wrote. “He will be great!”

I am pleased to announce that our very talented Deputy Secretary of Defense, Patrick Shanahan, will assume the title of Acting Secretary of Defense starting January 1, 2019. Patrick has a long list of accomplishments while serving as Deputy, & previously Boeing. He will be great!

The abrupt decision comes as Trump's anger has boiled over at Mattis’s resignation letter, which was widely seen as a rebuke of the president's foreign policy.

Senior administration officials said Trump chafed at negative media coverage of the letter, which featured a parade of lawmakers and retired military leaders appearing on cable news to criticize his leadership and praise Mattis’s resolve, and eventually reached a breaking point.

Trump sent the tweet announcing Mattis’s early exit while at the White House, where he has spent the past few days after cancelling his Christmas trip to his Mar-a-Lago club in South Florida due to the government shutdown.

Pentagon officials offered terse reactions to Trump’s announcement.

“The secretary of Defense serves at the pleasure of the president. Sec. Mattis will work with Deputy Shanahan and department leadership to ensure that the [Defense Department] remains focused on the defense of the nation during this transition,” said Dana White, a spokeswoman for Mattis.

Army Lt. Col. Joe Buccino, spokesman for Shanahan, said only that “the deputy secretary of Defense will continue to serve as directed by the president.”

Trump initially praised Mattis last Thursday after announcing his departure, tweeting that the retired Marine Corps general would be exiting “with distinction” and was a “great help” in his efforts to strengthen the U.S. military.

White House press secretary Sarah Huckabee Sanders on Friday signaled Trump would allow Mattis to leave gracefully, telling Fox News “this will be orderly process and it will continue to be a good relationship over these next couple of months.”

But after Mattis handed Trump his resignation letter, which said he would leave Feb. 28, people in Washington expressed shock at how forceful the Defense secretary was in rebuking the president’s stances on issues like overseas alliances and relationships with adversaries.

One former White House official who worked closely with Mattis's team described the letter as “a 21 gun f--- you.”

The president had not yet read Mattis’s letter before tweeting praise for him, according to a senior administration official.

By Saturday, Trump swiped at Mattis in a Twitter post that revealed his mounting frustration with the Defense secretary.

“When President Obama ingloriously fired Jim Mattis, I gave him a second chance,” Trump wrote. “Some thought I shouldn’t, I thought I should. Interesting relationship-but I also gave all of the resources that he never really had. Allies are very important-but not when they take advantage of U.S.”

When President Obama ingloriously fired Jim Mattis, I gave him a second chance. Some thought I shouldn’t, I thought I should. Interesting relationship-but I also gave all of the resources that he never really had. Allies are very important-but not when they take advantage of U.S.

Trump’s decision to speed up Mattis’s departure is likely to further rattle lawmakers, national security professionals and U.S. allies who saw the retired general as a stalwart defender of the post-World War II international order that the president has derided as unfair to America.

It also means Mattis will not oversee U.S. troop drawdowns in Syria and possibly Afghanistan, two decisions he opposed and that ultimately helped trigger his resignation.

Mattis was expected to testify before Congress next month about the administration’s national security strategy, a setting where he could have faced tough questions about his resignation and the troop withdrawals. It’s not clear if lawmakers still plan to have him testify.

Brett McGurk, the U.S. special envoy to the global coalition fighting the Islamic State in Iraq and Syria, also resigned over the Syria withdrawal and there has been speculation that other officials could follow Mattis and him out the door.

The reshuffle of Trump’s national security team comes as Trump has entered perhaps the most tumultuous stage of his presidency, confronting a government shutdown, signs of a slowing economy and intensifying investigations into his campaign’s possible ties to Russia and his businesses.

Shanahan, a former Boeing executive, was named deputy Defense secretary in July 2017. He reportedly has strong relationships with both Trump and Vice President Pence.

At the Pentagon, Shanahan has been deeply involved in procurement and budgeting, two subjects in which Trump has showed keen interest.

But unlike Mattis, Shanahan does not have deep military or government experience. It’s not clear whether the president will consider him as a candidate to lead the Pentagon on a permanent basis.