There were reports in October last year that the former military commanders in the Trump administration – James Mattis, John Kelly and HR McMaster – had renewed their pact not to be abroad at the same time. At least one will stay behind, they had decided, as a check against the wilder actions of the president.

Ten months on, Lieutenant General McMaster has gone as national security adviser, General John Kelly has been sidelined and on his way out. The chief of staff, it is reported, now spends a lot of his working day in the gym and privately says he does not care if Trump gets impeached.

According to the latest revelations from the White House, contained in Bob Woodward’s new book, Fear: Trump in the White House, the general can’t wait to get out of “crazytown” and thinks the president is an “idiot” and “unhinged”.

General Mattis is now really the last man standing among the three who felt it was their patriotic duty to protect the nation from a president they have been viewing with increasing alarm.

The question, however, is just how much longer will Mattis last in his job. The defence secretary’s influence is dwindling. Trump has ignored his advice against tearing up the Iran nuclear deal; pulling out of the Paris climate change accord; moving the US embassy in Israel to Jerusalem; dealing with North Korea’s Kim Jong-un; banning transgender service personnel and sending the National Guard to the Mexican border.

The President has reportedly complained that Mattis is trying to block his radical approach and that the general looks down on him – which, of course, he does. Woodward’s book says Mattis regarded Trump as having the knowledge of a “fifth or sixth grader” on matters of foreign affairs

It should be noted that both Kelly and Mattis have denied the claims made by Woodward about their view of Trump. But the sentiments they are said to have expressed are remarkably similar to other accounts which have emerged about the fractious administration.

Fear: The 7 most explosive passages from Bob Woodward's Trump expose

What is clear is that there has been a change in Trump’s relationship with the security establishment. He had shown an infatuation with the military in coming to office with the appointments he made. But his repeated denigration of people who had served their country with sacrifice and distinction has led to first, dismay, and then disgust among many who guard the nation’s security.

The insults towards John McCain have been one of the egregious examples of this: he said of the senator, who was shot down and imprisoned in Vietnam, "he’s not a war hero... I like people that weren’t captured". Trump, of course, heroically avoided getting captured in Vietnam by repeatedly dodging the draft, a position that has been viewed with particular disgust.

Trump refused to release a White House statement praising McCain, countermanding officials (including, it is said, Mattis). The defence secretary, in his own statement, lauded McCain for a life embodying the military motto “not for self, but for country”, the opposite of the conduct of the sitting president, to his many critics.

Senior figures in the armed forces are increasingly, and publicly, showing their disapproval of Trump. When the President revoked security clearance for John Brennan, the former CIA head who has become one of his trenchant critics, Admiral William McRaven, who was in charge of the Navy Seal raid which killed Osama bin Laden, volunteered to have his own clearance taken away. McRaven described Brennan as: “One of the finest public servants I have ever known. Few Americans had done more to protect this country than John. He is a man of unparalleled integrity whose honesty and character have never been in question.”

Trump’s one sided adoration of the armed forces may be over. McMaster’s replacement as national security adviser is John Bolton, a fellow Vietnam draft dodger. Among the names being for Mattis’s possible successor is Stephen Hadley, who, like Bolton, became notorious for claims over non-existent weapons of mass destruction, disregarding cautions from the FBI and CIA.

Mattis has had one victory: simply ignoring Trump’s demand that Syria’s Bashar al-Assad is killed after the last chemical attack. But, overall, the losses keep mounting up for the former Marine commander. He lost his argument against Trump’s fanciful "space force", leaving it to vice president Mike Pence to announce a vanity project which will be hugely costly before it almost certainly dies a death on Trump’s departure.

The chosen battleground for the defence secretary now is very much terrestrial: trying to protect America’s alliances. There is little secret about Mattis’s dismay at Trump’s constant attacks on Nato. He is now out of tune with Trump on relationships with two strategic partners – South Korea and India.

Mattis stated that the annual military exercises with South Korea will continue, while Trump has declared that they will be cancelled. He has complained about the cost and has claimed that saving it is one of the dividends of his “hugely successful” summit with Kim Jong-un, after which he tweeted that North Korea’s “nuclear threat is over”. Trump has since cancelled a trip to Pyongyang by secretary of state Mike Pompeo, accusing Kim of failing to start the denuclearisation process. But such contradictions are nothing new for the US president.

Successive US administrations had spent years cultivating India as a counterweight against China. Mattis tried, and failed, to get a waiver for New Delhi on tariffs imposed in Trump’s trade war. The move directly led to Beijing, which is of course one of the main targets of American tariff, and Delhi being pushed closer together. Mattis is now struggling to get waivers for India for more threatened sanctions, this time over the purchase of a Russian missile system.

The best anti-Trump placards from the London protests Show all 14 1 /14 The best anti-Trump placards from the London protests The best anti-Trump placards from the London protests Time for a break-up? Harriet Hall The best anti-Trump placards from the London protests Sometimes simplicity works best. The best anti-Trump placards from the London protests There’s no place for Trump's other policies in our society. Harriet Hall The best anti-Trump placards from the London protests Many were quick to point out that in the UK, Trump means 'fart'. Harriet Hall The best anti-Trump placards from the London protests Some people were looking out for The Queen Harriet Hall The best anti-Trump placards from the London protests There's a Mean Girl's quote for every occasion Harriet Hall The best anti-Trump placards from the London protests There were a lot of hair references at the march toupée. Sorry, today. Harriet Hall The best anti-Trump placards from the London protests Frack off. The best anti-Trump placards from the London protests Try and read this out without singing it... Harriet Hall The best anti-Trump placards from the London protests A message all Brits will understand. Harriet Hall The best anti-Trump placards from the London protests Simple, and to the point Harriet Hall The best anti-Trump placards from the London protests We don't entirely understand this one, but we do rather like it Harriet Hall The best anti-Trump placards from the London protests The Inbetweeners sends a hilariously petulant message Harriet Hall The best anti-Trump placards from the London protests Never underestimate Cher Horowitz Harriet Hall

The confrontations have been pretty open. Trump had agreed at the Singapore summit to suspend the military exercises in return for North Korea making concrete moves – an offer made without informing the defence secretary. Asked recently whether the drills would be resumed, Mattis said the suspension was "a good faith measure [but] our military posture has not changed since the conclusion of the Singapore summit and we have no plans at this time to suspend any more exercises".

Trump’s response was a rambling four-part tweet referring to himself in the third person, headed “STATEMENT FROM THE WHITE HOUSE” and stating: “The President believes that his relationship with Kim Jong-un is very good and warm one and there is no reason at this time to be spending large amounts of money on joint US-South Korea war games.” They may be re-started in the future, he allowed, when – of course – “they will be far bigger than ever before”.

The threat of punitive economic measures on India comes over New Delhi’s plans to purchase Russia’s new S-400 missiles system, which Washington says will breach US sanctions on Moscow. Mattis has pointed out that India (which got the bulk of its weapons from Russia during the Cold War) is bound to continue some of that trade while, in fact, increasingly switching to supplies from the west.

It is ironic that the sanctions on Russia are for interference in the US election which allegedly put Trump in the White House – allegations the president has described as “fake news”. They have been imposed by congress with Trump making little effort to hide that he did not approve of them.

The matter may boil down to a matter of commerce. The US is keen to sell New Delhi an alternative missile system. “When you invest in a system, you are investing in a relationship as well. Russia is not going to be a good partner for India or anybody else given the nature of the regime,” Randall Schriver, a mid-level Pentagon official opined. India can get Washington’s approval by spending vast sums on American weaponry instead, as Saudi Arabia, Qatar and others had done.

Addressing a group of soldiers on a visit to Afghanistan last year, Mattis said: “Our country right now has these problems, and you know it and I know it. It’s got these problems we don’t have in the military... you just hold the line until our country gets back to understanding and respecting each other and showing it.”