US President Donald Trump has said he is replacing Defense Secretary Jim Mattis two months earlier than had been expected, a move officials said was driven by Mr Trump's anger at Mr Mattis' resignation letter and its rebuke of his foreign policy.
On Thursday, Mr Mattis had abruptly said he was quitting, effective 28 February, after falling out with Mr Trump over his foreign policy, including surprise decisions to withdraw all troops from Syria and start planning a drawdown in Afghanistan.
Mr Trump has come under withering criticism from fellow Republicans and international allies in recent days over his moves to wind down US involvement in Syria and Afghanistan, against the advice of his top aides and US commanders.
The exit of Mr Mattis, highly regarded by Republicans and Democrats alike, added to their concern over what they see as Mr Trump's unpredictable, go-it-alone approach to global security.
In announcing his resignation, Mr Mattis distributed a candid resignation letter addressed to Mr Trump that laid bare the growing divide between them, and implicitly criticized Mr Trump for failing to value America's closest allies, who fought alongside the United States in both conflicts.
Mr Mattis said that Mr Trump deserved to have a defense secretary more aligned with his views.
Mr Trump made his displeasure clear on Saturday night by tweeting that Mattis had been "ingloriously fired" by former President Barack Obama and he had given Mattis a second chance.
Mr Obama removed Mr Mattis as head of US Central Command in 2013.
Mr Trump has said that Deputy Defense Secretary Patrick Shanahan would take over for Jim Mattis on an acting basis on 1 January.
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!
— Donald J. Trump (@realDonaldTrump) December 23, 2018
In a tweet, Mr Trump called the former Boeing Co executive "very talented."
In his letter, Mr 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 Mr Trump was irked by the attention given to Mr 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 Mr Trump was expected to pick a nominee for defense secretary over the next couple of weeks.
Defense Department spokeswoman Dana White said Mr Mattis would work with Mr Shanahan and Pentagon leadership to ensure the department "remains focused on the defense of the nation during this transition."
Mr 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 Mr Trump but which has met resistance from parts of the Pentagon.
A senior administration official told Reuters that Mr 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."
In a shock announcement on Wednesday, Mr Trump declared that US troops would leave Syria and significantly withdraw from Afghanistan.
A day later, US officials said the United States was planning on pulling about half of the 14,000 US troops in Afghanistan.
Mr Mattis, a retired Marine general whose embrace of NATO and America's traditional alliances often put him at odds with Mr Trump, had advised against the Syria withdrawal - one of the factors in his resignation.