Image copyright Getty Images Image caption Patrick Shanahan (pictured) will take over from General James Mattis, who resigned on Friday

US President Donald Trump has forced Defence Secretary James Mattis to leave his post early, appointing an acting successor to take over in the new year.

Gen Mattis, 68, strongly hinted at policy differences with Mr Trump when he resigned on Friday.

He offered to stay in the job until February but will now leave on 1 January after Mr Trump reportedly balked at media coverage of his exit.

Deputy Defence Secretary Patrick Shanahan, 56, will take over the role.

Mr Trump has lauded his achievements and described him as "very talented".

Skip Twitter post by @realDonaldTrump 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 Report

Mr Shanahan, a former executive at the aerospace giant Boeing, joined the Pentagon in July 2017 after Mr Trump nominated him.

He was reportedly a vocal supporter of the president's plan to establish a sixth branch of the armed forces, known as the "space force".

Originally from Washington state, Mr Shanahan studied mechanical engineering and business at the Massachusetts Institute of Technology and joined Boeing as an engineer in 1986.

The hammer comes down

Analysis by Anthony Zurcher, BBC News, Washington

Image copyright Getty Images Image caption James Mattis strongly hinted at policy differences with President Trump when he resigned

Donald Trump had initially framed James Mattis's departure as a "retirement" but his resignation letter - full of implied criticism of the president's foreign policy - showed that was not the case.

The president seldom handles rebukes kindly, so it became increasingly unlikely the former general would be allowed his requested two-month departure timeframe.

On Sunday morning, the hammer came down - as is the new norm - via a presidential tweet.

Mr Mattis's replacement, Deputy Secretary Patrick Shanahan, spent most of his career working for Boeing.

Having a former executive of a major defence contractor running the Pentagon, even on a temporary basis, is unusual, to say the least. It's a job usually held by politicians with military oversight experience.

Meanwhile, the president appears to be trying to douse the fire that started this personnel crisis. He also tweeted on Sunday that the US withdrawal from Syria - abruptly announced last week - would be "slow and highly coordinated".

Given the Mattis news, that may not be enough to calm the nerves of allies and assuage the anger of US foreign policy hands. It is, however, a start.

Gen Mattis resigned shortly after President Trump announced his decision to withdraw all US troops from Syria.

While not mentioning it in his resignation letter directly, the general previously warned that it would be a "strategic blunder".

In his letter, he also said the president had the right to appoint someone "whose views are better aligned with yours".

But shortly after announcing Mr Shanahan's appointment on Sunday, Mr Trump moved to calm widespread concerns over the pullout which he initially said would be "rapid".

Mr Trump said on Twitter that he had spoken with President Recep Tayyip Erdogan of Turkey about "our mutual involvement in Syria, & the slow and highly coordinated withdrawal of US troops from the area".

Mr Erdogan's office said the two leaders had agreed to "ensure coordination between their countries' military, diplomatic and other officials to avoid a power vacuum which could result following any abuse of the withdrawal and transition phase in Syria".

Kurdish forces in Syria, which Turkey regards as a threat, have been successfully fighting the Islamic State group with US support.

They now fear Turkey will use America's withdrawal to launch a new campaign against them.