A new and unhinged American president orders a pre-emptive nuclear strike against North Korea. The senior officials who surround him are terrified, desperate to thwart his will, resorting to subterfuge to prevent the man they serve from wreaking havoc. They are the resistance from within. Two of them have a hushed conversation about the 25th amendment of the US constitution, which allows for a president to be declared incapacitated. When that road is blocked, they contemplate an even more drastic solution …

That was the starting point of the novel whose manuscript I delivered in January 2017, two days after Donald Trump had sworn the oath of office. The book, To Kill the President, was published last year last year under the pseudonym Sam Bourne. When I wrote it, none of us knew for sure what the Trump presidency would look like. But this week, Washington Post legend Bob Woodward published Fear, based on detailed interviews with Trump insiders. Among other things, the book describes “repeated episodes of anxiety inside the government over Trump’s handling of the North Korean nuclear threat. One month into his presidency, Trump asked [the head of the US military] for a plan for a pre-emptive military strike on North Korea.”

‘If you become convinced the leader you serve is a danger to your country, where does your patriotic and democratic duty lie?'

True, Trump only asked for a plan, rather than ordering a nuclear assault, but what the two stories – my imagined one and the real one from Woodward – have in common is the president’s top lieutenants conspiring to ensure his orders are not implemented. By way of confirmation, this week also saw a bombshell opinion article in the New York Times, in which an unnamed “senior White House official” declared him- or herself part of “a quiet resistance within the administration” of Donald Trump, “working diligently from within to frustrate parts of his agenda and his worst inclinations”. The anonymous author further revealed that there had been “early whispers within the cabinet of invoking the 25th amendment”.

So, several figures inside Trumpworld have been wrestling with the very dilemma that animated my fictional characters. Put simply: if you’re convinced that the leader you serve is a danger to your country and the world, where does your patriotic and democratic duty lie? Should you resign and sound the alarm – or stay on the inside and do your best to reduce the danger?

Play Video 5:26 What is the 25th amendment and could it remove Trump? – video explainer

The debate triggered by both the mystery op-ed and the Woodward book suggests that most anti-Trumpers prefer the former option. The secret author has been roundly denounced, with the president’s own word, “gutless”, becoming the insult of choice. How cowardly to hide behind anonymity. How feeble to serve every day as an enabler of Trump, even as you have concluded that he is an amoral admirer of dictators, an “impetuous, adversarial, petty and ineffective” man whose decisions are “half-baked, ill-informed and occasionally reckless”. Surely it would be better to walk away – better still never to have worked for him in the first place – than to provide the moral cover of your own good name by continuing to serve him. Surely, if you truly believe that this man is a threat to the republic, your duty compels you to take action to remove him from office – rather than whinge anonymously while continuing to keep him in the White House.

I’m sympathetic to all those arguments, and there are extra ones that apply specifically to the secret writer. By refusing to be named, he or she has made it easy for Trump to tell his base that the whole thing is fake – that it is, in fact, a fiction. Worse, the article clings to the notion that the Trump administration has done some good things: “effective deregulation, historic tax reform”. This suggests the author has made the same devil’s bargain with Trump struck by congressional Republicans, evangelical Christians and others: give us the goodies we want, whether they be tax cuts or anti-abortion judges on the supreme court, and we’ll swallow whatever racist, bigoted foulness you serve up each day.

More deeply, there is a democratic problem. Like it or not, and of course most Guardian readers loathe it, Trump was elected to the US presidency under the rules. He does have a democratic mandate, one lacking in those officials who swiped incendiary documents off his desk before he could sign them, or who dispatched his military orders to bureaucratic oblivion. To support the frustration tactics of these aides sets a bad precedent. Let’s say Trump is succeeded one day by a progressive president: what would we make of unelected aides thwarting that president’s will?

So the case against the White House rebels is strong. And yet I can’t bring myself to condemn them entirely. Perhaps it’s because I spent several months putting myself in their shoes, but I don’t think the choice for the appalled Trump insider is quite as easy as the chorus of denunciation wants you to believe.

Imagine for a moment you’re the defence secretary, James Mattis, alarmed at Trump’s behaviour. Where are you most useful? You could try invoking the 25th amendment and declaring Trump unfit – but you’d have to get the vice-president, Mike Pence, and a majority of your cabinet colleagues, almost all of them Trump cronies, to agree; and then you’d have to get the Republican-controlled House and Senate to agree too. Given the spinelessness those groups have shown so far, your chances would be slim.

To Kill the President by Sam Bourne review – does fact Trump fiction? Read more

You could call a news conference, resign and denounce the president before the cameras. It would make a massive splash. But then, once again, the matter would revert to a Republican Congress that has shown no willingness to stand up to Trump, let alone impeach him, despite copious evidence of his unfitness for, and abuse of, office. Before long, Fox News would have branded you a closet liberal and Hillary-lover, Trump would have tweeted about something else, and the news caravan would have moved on.

Or you could stay in your chair, so that when Trump orders a new strategy for Syria – “Let’s kill the fucking lot of them”, according to Woodward – or bans trans people from the military, you’re in position to ensure his orders go nowhere. As it happens, the nuclear button is in the grip of Trump alone – it is among the least checked of presidential powers – but surely we all sleep better at night knowing that the likes of Mattis are at the Pentagon, rather than whichever unqualified but loyal crank Trump might put in his place.

Nor will it wash to cast these internal dissidents as agents of the “deep state”. They are not career civil servants, of the kind that sabotaged Harry Perkins, the fictional lefty British prime minister in Chris Mullin’s A Very British Coup. They are themselves political appointees, picked by Trump himself just last year. It suits Trump to depict their guerrilla action as the work of the machine against the people’s tribune – but it’s false.

If all that stands between us and Trump starting a world war are tricks and subterfuge, I’ll take those every time. But it’s clearly not the democratic way to deal with a president who poses a threat to US liberal democracy. The right way runs through the ballot box – either ejecting Trump in 2020 or electing a Democratic Congress that might hold him to account. Americans will have the chance to do that in less than two months. The world should pray that they take it.

• Jonathan Freedland is a Guardian columnist, and author of To Kill a President