President Donald Trump announced on Sunday that he was replacing James Mattis as secretary of defence two months earlier than had been expected, amid what officials said was anger at the general's resignation letter and the attention it had received.

Mr Trump's new appointment, the current deputy secretary of defence, Patrick Shanahan, will begin work on January, pushing out his boss from the post he was due to hold until the end of February.

Though Mr Shanahan's appointment had been widely predicted, it had not been expected so suddenly.

It effectively means General Mattis, who wrote a scathing resignation letter condemning the US leader's decision to withdraw troops from Syria and his disrespectful handling of allies, may not even return to the Pentagon to clear his desk.

A senior White House official said that Mr Trump was irked by the attention given to Gen. Mattis' rebuke of his foreign policy.

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

Pentagon officials had previously insisted Gen. Mattis would stay through February, when he would attend a NATO defence ministers meeting.