Defense Secretary James Mattis announced his resignation on Thursday — though he said he would serve through Feb. 28 — telling President Donald Trump in a resignation letter that he had the right to “a Secretary of Defense whose views are better aligned with yours.”

Trump announced on Twitter Thursday that Defense Secretary Jim Mattis will retire early next year:

….equipment. General Mattis was a great help to me in getting allies and other countries to pay their share of military obligations. A new Secretary of Defense will be named shortly. I greatly thank Jim for his service! — Donald J. Trump (@realDonaldTrump) December 20, 2018

The ouster comes a day after the news — reportedly catching congressional Republicans and military leadership by surprise, or at least, despite their protestations — that the United States would be withdrawing its troops from Syria.

According to the Washington Post, Mattis was among those with whom Trump met before making up his mind about the troop withdrawal. Mattis, the Post reported, argued that the Islamic State was still operational in the country, and that it would be a mistake to pull out troops.

The New York Times, citing unnamed officials, reported that Mattis resigned as a result of again not being able to convince Trump to keep U.S. forces in Syria on Thursday.

“My views on treating allies with respect and also being clear-eyed about both malign actors and strategic competitors are strongly held and informed by over four decades of immersion in these issues,” Mattis wrote in his resignation letter. “We must do everything possible to advance an international order that is most conducive to our security, prosperity and values, and we are strengthened in this effort by the solidarity of our alliances.”

He added: “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.”

Trump, though he once called Mattis one of “my generals,” has also distanced himself from the retired four-star Marine Corps general. “He’s sort of a Democrat,” Trump said of the defense secretary during a “60 Minutes” interview in October. “He may leave. I mean, at some point, everybody leaves.”

This post has been updated.