The question now facing both U.S. and foreign leaders is plain: Who will constrain Trump? Mattis was one of the few remaining officials who seemed able to twist the president’s arm out of his most rash and unwise decisions and impulses.

“Mattis is the last brake on a president that makes major life-and-death decisions by whim without reading, deliberation, or any thought as to consequences and risks,” said a senior U.S. national-security official on Thursday, who spoke on the condition of anonymity in order to talk freely. “The saving grace is that this president has not been tested by a major national-security crisis. But it will come, and when it does, we are fucked.”

While the administration has seen heavy turnover, there have been few resignations on principle, despite Trump’s frequent departures from norms. It’s also exceedingly rare for senior officials in any administration to resign in protest. There had been frequent speculation that Mattis might leave the Pentagon after some of Trump’s previous actions. The economic adviser Gary Cohn resigned over his disagreements with Trump about tariffs.

Mattis’s resignation brings to an end the single strangest stint in Trump’s inner orbit. Mattis was always a misfit: a westerner in a team of East Coast types, a veteran among mostly civilians, an ascetic among the profligate, an institutionalist among nihilists, a lifelong public servant among political climbers and businessmen, an aphorist serving a logorrheic president.

Yet Mattis put together one of the steadiest and most successful tenures of any Trump official, and managed to stay largely untainted by the dysfunction that has marked the administration and tarnished many aides. Mattis might be the only top official to emerge with his reputation enhanced. Nonetheless, the chaos of the Trump administration and his own differences of opinion with the president mean that Mattis’s accomplishments largely consisted of protecting the status quo—he was a defense secretary who spent most of his term on the defensive.

Mattis retired from a decorated career in the Marines—capped by a stint leading Central Command—in 2013, but he was pulled out of retirement to join the Trump administration in late 2016. The president-elect, spurned by many traditional Cabinet candidates, sought current and ex-military leaders, including Mattis, John Kelly, and Michael Flynn, to join his team. In Mattis’s case, he required a congressional waiver to serve as the head of the Pentagon, because he hadn’t been retired the minimum seven years.

Trump was particularly drawn to Mattis, who had an archive of colorful quotes—“I come in peace. I didn’t bring artillery. But I’m pleading with you, with tears in my eyes: If you fuck with me, I’ll kill you all”—and a colorful nickname, “Mad Dog.” It took months of Trump using the nickname before Mattis made clear he detested it.