FILE - In this April 9, 2018, file photo, Deputy Secretary of Defense Patrick Shanahan, right, listen as President Donald Trump speaks during a cabinet meeting at the White House, in Washington. A U.S. administration official says that Defense Secretary Jim Mattis will leave his post Jan. 1, 2019, as Trump is expected to name Shanahan as acting secretary. (AP Photo/Evan Vucci, File)
FILE - In this April 9, 2018, file photo, Deputy Secretary of Defense Patrick Shanahan, right, listen as President Donald Trump speaks during a cabinet meeting at the White House, in Washington. A U.S. administration official says that Defense Secretary Jim Mattis will leave his post Jan. 1, 2019, as Trump is expected to name Shanahan as acting secretary. (AP Photo/Evan Vucci, File) Credit: Evan Vucci

Irritated with the criticism and fallout from Defense Secretary Jim Mattis’s resignation, President Donald Trump on Sunday pushed the Pentagon chief out the door two months earlier than planned, an acrimonious end to a tense relationship that had been eroding in recent months.

In a series of tweets, Trump appeared to question why he had put Mattis in his Cabinet in the first place, and said deputy defense secretary Patrick Shanahan will take over as acting secretary on Jan. 1 to cover the accelerated departure.

The sudden change strips Mattis of any chance to further frame national security policy or smooth rattled relations with allies through the originally planned transition at the end of February. And it reflects White House displeasure with the retired Marine Corps general’s blistering resignation letter, which he delivered to Trump on Thursday.

Mattis resigned in protest over Trump’s decision to pull all U.S. troops out of Syria. U.S. officials, however, said that the reaction to his decision to leave – including the shock and dismay expressed on Capitol Hill – annoyed Trump and likely led to Mattis leaving earlier than planned.

“When President Obama ingloriously fired Jim Mattis, I gave him a second chance. Some thought I shouldn’t, I thought I should,” Trump tweeted Saturday, foreshadowing his displeasure and the Sunday announcement. He also fumed over the media coverage of his Syria withdrawal order, suggesting he should be popular for bringing troops home.

“With me, hit hard instead by the Fake News Media. Crazy!” Trump tweeted.

A White House official said Trump decided Mattis should leave the administration earlier than planned to avoid a drawn-out transition when someone on hand whom they consider a qualified deputy capable of running the Pentagon in an acting capacity. The official, who asked not to be identified publicly discussing personnel matters, said it made sense to have a quicker transition and not create problems.

The official said Mattis was notified of Trump’s wishes prior to today’s tweeted announcement.

Lt. Col. Joseph Buccino, a spokesman for Shanahan, said the former Boeing Co. executive will accept the appointment as acting secretary.

“Deputy Secretary will continue to serve as directed by the president, and the Department of Defense will remain focused on the defense of the nation,” Buccino said on Sunday.

It is unusual for the Pentagon to have an acting secretary of defense. Historically when a secretary has resigned, he has stayed on until a successor is confirmed. For example, when Chuck Hagel was told to resign in November 2014, he stayed in office until Ash Carter was confirmed the following February.

While Mattis’s resignation followed Trump’s announcement that he would soon pull all of the approximately 2,000 U.S. troops out of Syria, officials said that the decision was the result of an accumulation of disagreements.