Donald Trump will not go gentle into that good night: he will rage, rage, rage-tweet against the dying of his might. Indeed, he is already doing so. After a humiliating turnout at Saturday’s rally in Tulsa, Oklahoma – which capped one of the worst weeks of his presidency – Trump’s re-election chances look shakier by the day. Rattled and belligerent, he seems to be gearing up to contest a defeat in November.

“RIGGED 2020 ELECTION,” Trump tweeted on Monday morning. “MILLIONS OF MAIL-IN BALLOTS WILL BE PRINTED BY FOREIGN COUNTRIES, AND OTHERS. IT WILL BE THE SCANDAL OF OUR TIMES!” Mercifully, he took his fingers off the caps lock key at that point, but continued to fire off unhinged tweets about his enemies exploiting the pandemic to “cheat by using Mail-Ins!”

I am sure I don’t need to tell you that there is zero evidence of foreign countries colluding to attempt to stuff US ballot boxes. Nor is there evidence to back up Trump’s frequent assertions that postal voting is corrupt. But facts don’t seem to get in the way of Trump’s feelings. There is nothing Trump loves more than playing the victim. “PRESIDENTIAL HARASSMENT!” he tweeted on Monday. Along with “witch hunt”, “fake news” and “unfair”, it is one of his favourite phrases.

Trump certainly looks harassed. A seven-month low and Joe Biden is leading in the national polls by double-digits. Even Trump sycophants at rightwing outlets such as Breitbart are calling his behaviour “childish, selfish and self-destructive”.

If Trump is not re-elected, there is more at stake than a bruised ego; he could end up in jail. This may be why William Barr, the attorney general and Trump lapdog, just fired Geoffrey Berman, the US attorney for the southern district of New York, who is conducting investigations into associates of the president. If Trump loses, he wants a sympathetic prosecutor in New York.

But Trump does not plan to lose. One reason he may be so obsessed with election-rigging is that he is doing his best to rig the election himself. Earlier this year, the Trump campaign launched a multimillion-dollar legal battle to stop the Democrats making it easier to vote during the pandemic by, for example, expanding mail-in voting. Trump may be deluded about a lot of things, but he seems to realise that the greater the number of people able to vote, the worse his chance of re-election. He told the politics site Politico last week that losing the lawsuits could cost him a second term.

If my wildest dreams come true and Trump loses in November, it is, as his recent tweets make clear, almost inevitable that he will contest the results. Whether he is able to do this in court rather than just by screaming into the void depends on how close the results are in important states. “Close” is subjective – “I’d guess that Trump would claim ‘close’ if the margin is less than 10,000 – no matter the size of the state,” says Mark Tushnet, a constitutional law expert at Harvard. But even if he is able to demand a recount, Trump cannot barricade himself in the White House for ever.

  • Arwa Mahdawi is a Guardian columnist