The news that Diane James has resigned as UKIP leader after less than three weeks in post might prompt the following reaction. Post-Farage UKIP is the comedy party. What a bunch of bunglers. It cannot survive without its blazer-wearing chieftan Nigel and it will surely disappear down the plughole of history.

James seems to have concluded that she cannot navigate the treacherous internal affairs of a party which operates as though it is a golf club in which the committee members are at war – involving flamethrowers – over plans to redevelop the bar. It always reminds me of Hot Fuzz, the comedy set in a prim middle England market town ‎gone wrong.

Anti-UKIP far left campaigners complicate the situation further. James was upset after being spat at in Waterloo station, according to a Guardian report. For years Farage has needed security because of death threats. Having only taken the leadership reluctantly, James has already had enough and a new leader will be chosen, perhaps in a short campaign.

But this mess is not a disaster for UKIP. On the contrary, it is good for the party. And what is good for UKIP is bad for the ailing Labour party.

James was the wrong leader to take her party forward in the north of England, where the opportunity is greatest and Labour is in all sorts of trouble. Her demeanour, her interests and her background made her ill-suited to the task of convincing more working class voters who went for Brexit to make the leap to becoming UKIP voters. Either potential candidate – Paul Nuttall or Stephen Woolfe – could do it. And Suzanne Evans, hated by Farage factionalists on the basis that she is a talented modern woman, is a much more energetic campaigner than James. There are other candidates running, including England’s angriest man, but life is too short to worry about that.

Consider Labour’s difficulties. A party leadership that is viewed with scorn by most voters outside London is going to double down on being pro-uncontrolled migration, with Jeremy Corbyn effectively seeking to tell former and current Labour voters that they do not know what they are talking about when they express concern on immigration. This is a strategy perhaps best described as bold in an anti-politics climate.

Not only that. The party may be finished in Scotland, the base from which it rebuilt in the 1980s. It is on the run in Wales. And UKIP once it sorts itself out is coming after the party in the Brexity north of England and midlands.

The gap in the market for UKIP is for it to be the low immigration party in the north post-Brexit, that says once the Tories have done a deal (perhaps involving a compromise on quotas): “Look, the numbers are not down much at all. The Tories have sold you out to please pro-immigration big business.” Labour cannot make this case because it’s leadership has decided on a different course and anyone sensible – of the moderate wing – that might push for a change of policy is about to be challenged by the wide open borders far left and deselected. In such circumstances, if UKIP gets the right leader it is far from finished.