Luck can turn, and there’s no better evidence of that aphorism than the fate of UKIP in Stoke-on-Trent Central. For a long time, the self-styled People’s Army were the luckiest party in British politics. Every time it looked like infighting or scandal might derail their crusade against just about everybody, something would crop up to pull their irons out of the fire – Conservative MPs defecting, Juncker saying something barmy about a European superstate, migrants plunging the EU into crisis. Farage was a lucky general, aided by the fact they had a USP of being right about the EU.

Both of those factors have changed. Farage is gone – hanging onto his share of the media limelight while ditching the exhausting responsibilities of leading UKIP – and the referendum has produced a Conservative government which is championing Brexit, stripping UKIP of the role it held for 25 years as the only advocate of leaving the EU.

Losing their superstar leader and their core message at a stroke was always going to be dangerous. Paul Nuttall decided that the best form of defence is offence, and went straight onto the attack as soon as he became leader, laying out a stall intended to appeal to the patriotic working classes who have been let down by Labour for years and feel deeply uncomfortable about Corbyn’s views on almost everything.

As I wrote at the time, it was the right – indeed, the only – position that offered UKIP a chance of a future, but the party’s machine didn’t look up to the job of communicating and capitalising on it.

I didn’t foresee that Nuttall himself would be compromised by a series of untrue claims his own website and leaflets had made about his past. The fact his campaign became bogged down in correcting his own record on Hillsborough and his supposed career as a “professional footballer” certainly didn’t help him. After the flooring of Steven Woolfe, and the swift retreat of Diane James, Nuttall looked like his party’s only viable option – he has turned out to be rather less viable than anticipated.

But the problem is greater than his personal flaws. Fighting in what they called “the capital of Brexit” – in a by-election Farage unhelpfully said was of “fundamental” for the future of UKIP, up against a disastrous Labour leadership and a hapless Labour candidate – they barely advanced on their 2015 position. Despite Nuttall’s assertions that “UKIP’s time will come”, this was meant to be their moment and they fluffed it.

I’ve written before on this site about the structural problems that the People’s Army faces – its membership is drastically down, and what activists it does have are more enthusiastic than effective. During the referendum, may Tory Leavers in various parts of the country found to their dismay that UKIP were remarkably unstrategic on the ground, preferring high visibility street stalls and unwinnable arguments with convinced Remainers to the tougher but more worthwhile work of detailed canvassing and Get Out The Vote.

This is the strategic gulf between fighting to be noticed as a small party and fighting to win outright. It’s also the difference between a campaign that secures seats in a PR list system like the European elections and a campaign that wins you seats in a toe-to-toe First Past The Post election. UKIP’s success in the former and failure in the latter looks odd but is no mystery when you examine the details of how they work on the ground.

It’s undoubtedly true that their by-election results improved drastically during the last parliament. They were able to record strong second places in several contests, and won two. But it now looks like their campaigning reputation and operation were being flattered by circumstance – the rising salience of the EU, and particularly immigration, as an issue – and Farage’s uniquely strong media profile, both of which have been stripped away by the referendum and its aftermath. The fact their two victories (Carswell in Clacton and Reckless in Rochester) came with candidates with external experience of how to run a winning campaign no longer seems like a coincidence.

The portion of their improved by-election performances which did come from a boost in campaign management appears to have unravelled – while Lisa Duffy, their experienced campaign co-ordinator, was still involved in Stoke, the party centrally has lost key staffers and ended up looking quite rusty. It’s unimaginable that Farage would have been reduced to tweeting out amateurish graphics or walking up and down in front of TV reporters while aides shout “where’s the car?”, but that was Nuttall’s fate.

Meanwhile, they have failed to follow the Lib Dems in converting local election successes into organisational growth – indeed, they have developed a nasty habit of failing to hold in by-elections the seats which they won back in 2013-15. These losses suggest a party which was able to ride a rising tide, but failed to prepare itself for when the waters receded.

Nuttall’s job was already made harder by the task of following on from his party’s only iconic leader, the farce of the leadership contest and the pre-existing flaws in the UKIP ground machine. May made it harder for him by moving her tanks onto UKIP’s lawn both on Brexit and on grammar schools. Now that he has fallen at the first hurdle, and fallen badly, he risks contracting a fatal electoral illness: an air of despair. As the Government rolls on with Brexit, UKIP’s USP will be eroded still further, if it descends into yet more infighting then its supporters will become even more dispirited, and all the while the abolition of its MEPs – one of its few remaining sources of income and subsidy – looms ever closer.