WASHINGTON -- Irritated with the criticism and fallout from Defence Secretary Jim Mattis' 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 Defence Secretary Patrick Shanahan will take over as acting secretary on Jan. 1 to cover the accelerated departure.

Secretary of State Mike Pompeo, not the president, notified Mattis of the decision, said a senior administration official who insisted on anonymity to discuss personnel issues.

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 asked not to be identified publicly discussing personnel matters.

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 Defence will remain focused on the defence of the nation," Buccino said on Sunday.

It is unusual for the Pentagon to have an acting secretary of defence. 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' 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.

In a stunning resignation letter, Mattis made clear he did not see eye to eye with a president who has expressed disdain for NATO and doubts about keeping troops in Asia. Mattis was also unhappy with Trump's order to develop plans to pull out up to half of the 14,000 U.S. forces in Afghanistan.

Earlier Sunday, Trump's acting chief of staff said that Trump had known for "quite some time now" that he and Mattis "did not share some of the same philosophies ... have the same world view."

Mick Mulvaney told ABC's "This Week" that the president and his defence chief "just could never get on the same page" on Syria, adding that Trump had said since his presidential campaign that "he wanted to get out of Syria." Mulvaney said the president "is entitled to have a secretary of defence who is committed to that same end."

Asked whether Trump wanted a Pentagon leader willing to challenge him or someone in lock step with his views, Mulvaney said "a little bit of both."

"I've encouraged him to find people who have some overlap with him but don't see the world in lockstep with him," Mulvaney said.

The Pentagon on Sunday would only say that Mattis serves at the pleasure of the president.

Other officials said it wasn't clear whether Mattis had spoken directly to Trump about the accelerated departure. Mattis had been at work on Friday, and defence officials had insisted he was planning to stay through February, when he would attend a NATO defence ministers meeting.

Meanwhile, Senate Majority Leader Mitch McConnell, R-Ky., joined leading Republicans on foreign affairs in urging Trump to reconsider his decision to withdraw American forces from Syria.

"We believe that such action at this time is a premature and costly mistake that not only threatens the safety and security of the United States but also emboldens" the Islamic State group, President Bashar Assad's government, Iran and Russia, according to the letter, signed by McConnell and eight other senators, including Sen. Lindsey Graham, R-S.C., who organized it.

They asked Trump to "not make any final decision for 90 days to allow time to adequately study the impacts of this decision on our partners, our allies and the re-emergence of ISIS and other terror groups, to ensure our nation's strategic interests are secured."

But Mulvaney, asked on ABC whether there was any chance the president might change his mind on Syria decision, said: "No. I think the president has told people from the very beginning that he doesn't want us to stay in Syria forever. You're seeing the end result now of two years' worth of work. But keep in mind it's not unusual for a president to lose members of the Cabinet over these types of disagreements."

Just after tweeting the announcement about Shanahan, Trump said he had had "a long and productive call" with Turkey's president, Recep Tayyip Erdogan. Trump said they discussed IS, "our mutual involvement in Syria, & the slow & highly co-ordinated pullout of U.S. troops from the area. After many years they are coming home."

Shanahan, a longtime Boeing Co. executive, was nominated for the deputy job in early 2017.

He moved up through the management ranks at Boeing over a career that began in 1986. The Puget Sound Business Journal called him a Boeing "fix-it" man in a March 2016 report. He oversaw the company's global supply chain strategies and use of advanced manufacturing technologies. Shanahan was central to getting the 787 Dreamliner on track after production problems in the program's early years, the report said.

------

Associated Press writers Robert Burns and Darlene Superville contributed to this report.