President Donald Trump is forcing Defense Secretary James Mattis to leave his position by New Year's.

Mattis planned to stay until February 28 to ensure an orderly transition.

He'll be replaced by Patrick Shanahan, the deputy defense secretary, Trump said in a tweet.

Mattis quit his cabinet position because he disagreed with Trump's position to pull American troops out of Syria.

President Trump announced that Secretary of Defense James Mattis will leave his position by January 1. Patrick Shanahan, Mattis's deputy, will take over as the acting defense chief.

Mattis announced his resignation from the Defense Department on Thursday over President Trump's decision to withdraw United States troops from Syria and halve the number of troops in Afghanistan. Mattis originally said he would stay in his position until February 28 to ensure an orderly transition.

In his resignation letter, Mattis blasted Trump for mistreating allies.

"Because you have the right to have a Secretary of Defense whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down from my position," he wrote.

Read more: The incredible career of Jim Mattis, the legendary Marine general turned defense secretary who just quit the Trump administration

Trump has been furious about the resignation letter, according to the New York Times. On Saturday, he criticized Mattis in a tweet.

"When President Obama ingloriously fired Jim Mattis, I gave him a second chance. Some thought I shouldn’t, I thought I should," he wrote.

Mattis is a retired four-star Marine general who oversaw the United States Central Command from 2010 to 2013. He left the position when President Barack Obama was reportedly unhappy with his stance on Iran.

Before beginning his position as deputy secretary of defense in June 2017, Shanahan was an executive at the aircraft and weapons manufacturer Boeing. He does not have any prior government experience.