Defense Secretary Jim Mattis listens as President Trump speaks to journalists in the Cabinet Room of the White House on Oct. 23. (Leah Millis/Reuters)

THE RESIGNATION of Defense Secretary Jim Mattis propelled a bipartisan wave of anxiety across Washington and many other world capitals, and for good reason. Mr. Mattis was a rock of stability in an otherwise chaotic administration, and his anounced departure followed a pair of precipitous and reckless decisions by President Trump: the removal all U.S. forces from Syria and a 50 percent force reduction in Afghanistan. Combined with his wild swings between accepting a budget compromise and forcing a partial government shutdown on the weekend before Christmas, Mr. Trump appears unhinged and heedless of the damage he might do to vital national interests.

In his resignation letter, Mr. Mattis soberly laid out some of the stakes. He stressed the importance of “our unique and comprehensive system of alliances and partnerships” and of “treating allies with respect.” The contrast with Mr. Trump’s tweets claiming that the United States gains “NOTHING” by “protecting others who . . . do not appreciate what we are doing” was stark.

Mr. Mattis rightly said the United States must be “clear-eyed about both malign actors and strategic competitors,” including China and Russia, which, he said, “want to shape a world consistent with their authoritarian model.” That was a response to the president’s unfounded dismissal of the continuing threat posed by the Islamic State and his persistant toadying to Russian President Vladi­mir Putin — who, for his part, was quick to praise the Syria pullout.

Mr. Trump claims he was acting on a campaign promise by ordering troops home from the Middle East, but that ignores the reality that for two years he pursued a very different policy at the unanimous urging of his national security team. His abrupt shift came without any process of internal deliberation, or consultation with allies, or, it would seem, serious consideration of the potential consequences. These could be far-reaching: the revival of the Islamic State; the rise of Iran and Russia as masters of the Middle East; a serious deterioration of Israel’s security; and the collapse of an Afghan government that the United States has spent 17 years fostering and defending.

It’s understandable that, having tried and failed to dissuade the president acting on his destructive impulses, Mr. Mattis would separate himself from the administration. But his advice to Mr. Trump to find a defense secretary “whose views are better aligned with yours,” may be hard to follow. At least two of the candidates who have been talked about as possible successors to Mr. Mattis, Sen. Tom Cotton (R-Ark.) and retired Gen. Jack Keane, condemned the Syria withdrawal. Anyone qualified to lead the Pentagon would find it hard to support a decision to abandon military missions and betray U.S. allies with so little consideration.

A bipartisan chorus of senators joined Mr. Cotton in calling the Syria withdrawal “a costly mistake,” and Senate Majority Leader Mitch McConnell (R-Ky.) pronounced himself “distressed” at Mr. Mattis’s departure. He urged Mr. Trump to find a new secretary who shared the veteran general’s principles. Perhaps the Republican Senate caucus can use its advise and consent powers to push the president back toward responsible national security policies. Failing that, the United States could be headed toward a series of foreign disasters.