President Donald Trump announced on Thursday that Secretary of Defense General Jim Mattis would be retiring in February.

“General Jim Mattis will be retiring, with distinction, at the end of February, after having served my Administration as Secretary of Defense for the past two years,” Trump announced on Twitter.

News of Mattis’ departure broke hours after the president ordered all United States troops be withdrawn from Syria, despite protests from his top military advisers. Other military advisers expressed fear on Thursday that Trump would order the withdrawal of troops from Afghanistan in a similar manner.

Mattis released his resignation letter shortly after Trump’s announcement on Twitter, arguing his views on foreign policy were different than the president.

“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,” Mattis wrote.

The general also expressed his support for sustaining the Defeat ISIS coalition overseas in his letter as well as the principles of opposing authoritarian regimes in China and Russia, and the importance of treating allies with respect.

A senior White House official told reporters that Mattis and the president met on Thursday afternoon prior to his resignation.

Trump praised Mattis on twitter for “tremendous progress” in the military after successfully lobbying Congress to restore billions of dollars to the Defense Department.

Throughout his presidency, Trump was impressed by the star power that Mattis brought to the job, including the mythology of “Mad Dog Mattis” that traveled with the former Marine General.

“A new Secretary of Defense will be named shortly,” Trump wrote. “I greatly thank Jim for his service!”

Trump frequently boasted about the former “generals” in his administration but became frustrated when they were committed to establishment thinking in foreign entanglements.

Gen. H.R. McMaster left the White House in March, Gen. John Kelly is leaving in January, and Mattis is now scheduled to leave in February.