If Donald Trump forces a shutdown of the US federal government, as happened this weekend, that in the end is a matter for Americans. When the president’s personal charity, the Trump Foundation, is closed following accusations of “a shocking pattern of illegality”, as was the case last week, the nation’s voters are free to form their own conclusions. Whether or not the US head of state is a criminal adulterer who allegedly conspired to pay hush money to former mistresses will ultimately be decided in the US courts.

But when Trump abandons the fight against Islamic State terrorists and places British, Kurdish and other allied forces in Syria and Afghanistan at increased risk by withdrawing US troops, as he did last week, when he ignores European partners and does the bidding of authoritarian leaders hostile to western democratic values, and when he indulges in a destructive tariff war that helped crash the markets last week, stokes international tensions and threatens global prosperity, then his reckless behaviour is everybody’s business.

This is the situation, almost halfway through Trump’s four-year term, that now confronts all those around the world who look to the US for leadership and example. Americans have a right to elect whoever they wish as president. Equally, the rest of us have a right to expect that the person they choose honours the multilateral alliances, commitments and responsibilities agreed by predecessors. Otherwise, America’s ability and fitness to lead will be lost.

James Mattis, the US defense secretary who quit last week over Trump’s Syrian volte-face, understands this very well. His resignation letter is a classic of its kind. He declared that America’s strength was “inextricably linked” to its international partnerships, especially Nato. Trump has consistently denigrated Nato, as part of his war on multilateralism. Coming from a highly respected figure, this was a stunning rebuke.

But Mattis wasn’t finished. It was essential to be “clear eyed” about the threat posed by “malign actors and strategic competitors”, he wrote. “It is clear that China and Russia, for example, want to shape a world consistent with their authoritarian model.” Given Trump’s notorious chumminess with Vladimir Putin, and the continuing FBI investigation into his 2016 campaign’s alleged collusion with Russia, it was a telling blow. Mattis’s letter ended abruptly, without any of the customary flourishes or thanks. Trump, reportedly, was incandescent with fury.

The reasons why Trump behaves the way he does are matters for conjecture or for a judge. In a scathing editorial, the New York Times likened the president to Petyr Baelish, a dysfunctional character in Game of Thrones who thrives on chaos. “For most people, uncertainty and disorder are scary, unsettling forces to be avoided. But for Mr Trump, they are cherished friends and strategic assets... The president clearly believes that throwing everyone else off balance gives him an edge,” the paper said.

This explanation in no way excuses Trump’s recent actions, nor was it meant to. Suggestions that Trump is simply acting to shore up his electoral base, for example by insisting on funding the promised border wall with Mexico, are not the whole story, either. In part at least, a person – any person – is defined by the friends they make and the company they keep. Since taking office, Trump has squandered the counsel and goodwill of many able people, Mattis among them. At the same time, he has cosied up to unelected foreign dictators, autocrats and “strongmen” such as Turkey’s Recep Tayyip Erdoğan, who pushed him into last week’s U-turn on Syria.

Trump is a liability on foreign policy, a global security risk and an untrustworthy, unreliable partner. But worse than all of that, the depth of his commitment to representative democracy and rule by consent is open to serious doubt. If things get really bad in America in the next two years, that’s the biggest worry.