Washington: US President Donald Trump says he is replacing Defence 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 February 28, after falling out with Trump over his foreign policy, including surprise decisions to withdraw all troops from Syria and to 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 US 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 Defence Secretary Patrick Shanahan would take over on an acting basis from January 1.