WASHINGTON (Reuters) - U.S. President Donald Trump on Sunday said he was replacing Defense Secretary Jim Mattis two months earlier than had been expected, a move officials said was driven by Trump’s anger at Mattis’ resignation letter and its rebuke of his foreign policy.

On Thursday, Mattis had abruptly said he was quitting, effective Feb. 28, after falling out with Trump over his foreign policy, including surprise decisions to withdraw all troops from Syria and start planning a drawdown in Afghanistan.

Trump has come under withering criticism from fellow Republicans, Democrats and international allies over his decisions about Syria and Afghanistan, against the advice of his top aides and U.S. commanders.

The exit of Mattis, highly regarded by Republicans and Democrats alike, added to concerns over what many see as Trump’s unpredictable, go-it-alone approach to global security. Trump said Deputy Defense Secretary Patrick Shanahan would take over on an acting basis from Jan. 1.

In announcing his resignation, Mattis distributed a candid resignation letter addressed to Trump that laid bare the growing divide between them, and implicitly criticized Trump for failing to value America’s closest allies, who fought alongside the United States in both conflicts. Mattis said that Trump deserved to have a defense secretary more aligned with his views.

Trump, who tweeted on Thursday that Mattis was “retiring, with distinction, at the end of February,” made his displeasure clear on Saturday by tweeting that the retired Marine general had been “ingloriously fired” by former President Barack Obama and he had given Mattis a second chance.

Obama removed Mattis as head of U.S. Central Command in 2013 because of what officials at the time said were perceived to be his hawkish views on Iran.

Thursday’s tweet was dictated to an aide to send before Trump read Mattis’ resignation letter, a senior administration official told reporters on Sunday.

“That’s not the kind of letter of resignation I think you should write,” the official said, adding Secretary of State Mike Pompeo had told Mattis on Sunday he would be leaving on Jan. 1.

Slideshow ( 3 images )

In a tweet on Sunday, Trump praised Shanahan, a former Boeing Co executive, as “very talented.”

In his letter, Mattis had said he would step down at the end of February to allow for a successor to be confirmed and attend Congressional hearings and a key NATO meeting.

A senior White House official said that Trump was irked by the attention given to Mattis’ resignation letter.

“He just wants a smooth, more quick transition and felt that dragging it out for a couple of months is not good,” the official said, on condition of anonymity.

The official said Trump was expected to pick a nominee for defense secretary over the next couple of weeks.

Defense Department spokeswoman Dana White said Mattis would work with Shanahan and Pentagon leadership to ensure the department “remains focused on the defense of the nation during this transition.”

Shanahan, in his job as deputy defense secretary, has largely focused on internal Pentagon reform and issues like the creation of a Space Force, a project championed by Trump but resisted by some lawmakers and some in the Pentagon.

A senior administration official told Reuters that Shanahan “has a deep-seated understanding of military operations, and global security affairs, and importantly, has the breadth of large-scale business management experience that will enable him to effectively oversee the Defense Department.”

Slideshow ( 3 images )

‘SLOW’ SYRIA PULLOUT

In a shock announcement on Wednesday, Trump said he was withdrawing U.S. troops from Syria, citing its cost both in terms of lives of U.S. military and financially. A day later, U.S. officials said the United States was planning on pulling out about half of the 14,000 U.S. troops in Afghanistan.

Mattis, whose embrace of NATO and America’s traditional alliances often put him at odds with Trump, had advised against the Syria withdrawal - one of the factors in his resignation.

On Sunday, Trump said in a tweet that he had spoken with Turkish President Tayyip Erdogan about a “slow and highly coordinated” withdrawal, suggesting that he might slow down the process after the barrage of criticism.

A U.S military official, speaking on condition of anonymity, said the withdrawal would be “safe, professional and deliberate” but was not aware of any new guidance from the White House.

A plan on the pullout is expected to be presented by commanders to the Pentagon this week, the official said.

French President Emmanuel Macron said on Sunday he deeply regretted Trump’s Syria decision.

The plan has also prompted unusually sharp criticism of Trump from some of his fellow Republicans.

Senator Bob Corker, the influential Republican chairman of the Senate Foreign Relations Committee, said he was “saddened” by Trump’s withdrawal decision.

“I think he knows he made a mistake,” Corker, who is retiring, said on CNN. “The president’s tendencies are to dig in and double-down if he knows he has done something that is probably incorrect.”