In mid-October General Joseph Dunford, the chairman of the US joint chiefs of staff, issued a discreet warning about the continuing threat from Islamic State.

While he noted that the group’s self-proclaimed caliphate had shrunk to almost nothing in terms of territory, he pointed to the hundred foreign fighters a month still crossing Turkey’s border into Iraq and Syria that suggested a continuing level of resilience.

“It’s the flow of foreign fighters,” said Dunford speaking to a conference on countering extremism, “the ability to move resources, and the ideology that allows these groups to operate.”

Those remarks have taken on a powerful new significance following the resignation of the US defence secretary, James Mattis, on Thursday over Donald Trump’s sudden decision to withdraw 2,000 US troops from Syria. Mattis objected to this move, and also to Trump’s idea to consider the rapid drawdown of almost half of US forces in Afghanistan.

Mattis’s resignation letter on Thursday made sharply clear that the Pentagon is starkly and bitterly at odds with the Trump White House, not only on issues of military strategy in conflicts where US troops are currently deployed and facing hazards, but over the wider issues of international alliances and responsibilities, including a desire to protect US relationships within Nato.

Senior Pentagon figures such as Mattis and Dunford view how the US withdraws from conflicts as being of as great importance as how hostilities are commenced.

The conditions of Trump’s planned withdrawal, the argument goes, would not only leave one-time allies exposed – as the Kurds have already complained – but would also deliver profoundly negative political and diplomatic signals to both competitors and friends.

Seen through this prism, it is possible to disagree with the trajectory of US military engagement in Syria and Afghanistan, but still find Trump’s approach dangerously reckless and unmoored – as so much of his decision-making is – from a practical standpoint.

One of the few to welcome Trump’s Syria decision, perhaps unsurprisingly, has been the Russian president, Vladimir Putin, who remarked: “Donald’s right, and I agree with him.” Russia’s influence in the Middle East will be bolstered.

For their part, Israeli analysts have already indicated that they believe that Trump’s pullout will open the way for Iran to move into the vacuum, bringing the prospect of a confrontation between Israel and Iran closer.

The reality is that from the perspective of US allies, both in Europe and elsewhere, Mattis represented the best hope of a heavily diluted multilateralist continuity with the Obama era despite Trump’s instincts.

The defence secretary was credited with being a key advocate within Trump’s cabinet of the US remaining a part of the international framework on Iran’s nuclear programme. Mattis insisted too that America’s role in Syria was to counter Isis more than Iran.

But it is not only on the international stage that Mattis will be missed. In the US political context the departure of Mattis will have an outsized impact.

He was the last of the senior military figures recruited by Trump to remain in office, and insiders say that he insulated the huge bureaucracy of the Pentagon from much of the craziness that infected the rest of Washington.

Mattis was also credited with being a last steadying influence over Trump’s most impetuous ideas, blocking such preposterous suggestions as assassinating Bashar al-Assad, to the president’s desire to mount a North Korean-style military parade in his own honour.

Perhaps most striking, however, was Mattis’s quiet opposition to the president on the deployment of US troops to the Mexico border, as Trump ramped up xenophobic fears in the run-up to this autumn’s mid-term elections. He sent fewer soldiers than Trump demanded and undercut the president’s suggestion they could fire on migrants throwing stones.

The troops, Mattis memorably told reporters, were “not even carrying guns for Christ’s sake!”

In a crazy week that has seen Trump more encircled by legal threats, and more erratic than perhaps at any time in his rollercoaster presidency, the world may miss the presence of Mattis.

• Peter Beaumont is a senior reporter on the Guardian’s Global Development desk. He has reported extensively from conflict zones including Africa, the Balkans and the Middle East and is the author of The Secret Life of War: Journeys Through Modern Conflict