Secretary of Defense James Mattis resigned on Thursday, writing in an unsparing letter that he was stepping down because the president had “the right to have a Secretary of Defense whose views are better aligned with yours.”

Mattis’s resignation comes a day after President Donald Trump made the abrupt decision to withdraw 2,000 troops from Syria, and his resignation letter notes the differences in Mattis’s worldview compared to Trump’s.

In the letter, Mattis reiterates his “core belief” in America’s alliance and partnerships, specifically NATO, and America’s need to be “resolute and unambiguous” in challenging countries such as China and Russia.

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

Defense Secretary James Mattis has resigned. Here’s the letter: pic.twitter.com/e2PulyXpXZ — Elizabeth McLaughlin (@Elizabeth_McLau) December 20, 2018

The tone of Mattis’s resignation letter clashed with Trump’s own announcement, which came shortly before the letter was released. Trump characterized Mattis’s decision to quit as a retirement.

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

Trump credited Mattis with helping his administration with the “purchase of new fighting equipment” and helping Trump get “allies and other countries to pay their share of military obligations.” Trump added that he would name a new secretary of defense shortly.

....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

Mattis’s departure will leave the Trump administration more chaotic

Mattis, a retired four-star general who went by the call sign “Chaos” in the Marine Corps, was considered by many to be one of the president’s most critical Cabinet members in part because he acted as a strong check against Trump’s worst national security impulses.

With him gone, National Security Adviser John Bolton and Secretary of State Mike Pompeo will likely face less resistance as they offer more hawkish advice on North Korea, Iran, and more.

Mattis had a mixed record of success with Trump. Mattis opposed pulling out of the Iran deal; moving the US embassy in Israel to Jerusalem; creating a Space Force; and starting a trade war with America’s allies. But the now-former secretary failed to persuade Trump to see things his way on each of those issues, despite his good rapport with the president.

Perhaps even worse, the president also kept Mattis out of the loop on other major military announcements, including halting military exercises with South Korea and banning transgender troops from the military. (Trump announced the latter while Mattis was on vacation.)

Mattis did have a few notable successes, though. He reportedly stopped Trump from ordering the assassination of Syrian President Bashar al-Assad, a move that would’ve escalated Syria’s brutal civil war and brought the US much deeper into the conflict.

He also ensured the Trump stuck to a diplomatic approach with North Korea rather than a military one. And he convinced Trump that torture was a bad idea.

The former Pentagon chief made some questionable decisions despite the president, too.

Early on in the administration, he recommended an attack on terrorists in Yemen that led to the death of a Navy SEAL. He also convinced Trump to continue America’s war in Afghanistan. He also avoided speaking on camera to press and curtailed media access to the Pentagon.

Ultimately, though, Mattis’s tumultuous time paints a picture of a sharp mind and defender of America’s traditional role in the world who struggled to agree with his boss on matters of life and death. And it seems clear from Mattis’s resignation letter that he feels he can no longer perform that task.

The worry now is that, with Mattis gone, Trump is left with few if any moderating influences on his national security team. Mattis — along with National Security Adviser H.R. McMaster and Secretary of State Rex Tillerson, both ousted — was frequently labeled one of the few “adults” in the room whose military and strategic expertise would help him gain Trump’s trust and moderate the president’s most dangerous foreign policy impulses.

Like much in Trump’s world, it didn’t happen quite that way. But many still say they’ll miss Mattis — and that the US foreign policy may be worse off without him.

“I’d rather have Jim Mattis in the room than not in the room,” Leon Panetta, one of former President Obama’s defense secretaries, told Vox in March, nearly 10 months before Mattis’s ouster. “His legacy will be he fought the good battle. But because of the nature of the president, it was one he couldn’t win.”