By Jonathan Lis

The narrative was written. The bookies had stopped taking bets. Nigel Farage had arrived to bask in his victory. The Brexit party was to sweep Peterborough like a horde of free-market Vikings. And then it didn't.

Last night Labour held the seat it had taken in 2017 with a majority of 683 – up on 607 two years ago. This consolidates Peterborough's historic status as an ultra-marginal. The difference is that last time the close challenger was the incumbent Conservative party. This time it was a party which has only existed for a few months.

This by-election was one of the most interesting in years. It was the first to follow the recall of an MP, after Labour's Fiona Onasanya was jailed for perverting the course of justice and then formally ousted by a constituent petition. More significantly, it was the first competitive by-election to take place at a uniquely febrile moment: the country in chaos, our two main parties paralysed on Brexit, a day before the prime minister resigns. As a Brexit-supporting Labour-Tory marginal, a few weeks after the Brexit party won a national poll and the Tories slumped to fifth place, Peterborough had the capacity to show us how politics was about to unfold.

So what did we find out?

First, the result provides a huge boost to Jeremy Corbyn. Labour had been written off here, and it separately emerged that candidate Lisa Forbes had 'liked' anti-Semitic content on social media. Her explanation and apology will not have reassured everyone. The party nevertheless fought a determined local campaign and energised its core vote – something it notably failed to do in the European elections two weeks ago. Its share of the vote was up almost 14% on those elections, when it polled only 17% in the Peterborough council area.

Labour has demonstrated that it can still claim victories in Leave areas, and that matters. It's also a vote of confidence in Labour's Brexit strategy. The party has continued its famed 'triangulation' between Leavers and Remainers but has greatly softened its stance on a second referendum. They haven't guaranteed a 'confirmatory vote' but discuss it much more than they did – and still managed to win a Brexit-supporting seat. There is ammunition here for both referendum-sceptics and advocates.

The bad news for Labour is that its vote share was still 17% down on its result two years ago. Three words here: the Brexit party. This by-election became a straight-up tussle between the two. (As many on social media have noted, Labour defeated them by a margin of 52 to 48%.) So what became of Farage's gold-plated vomit-machine?

Certainly, it performed extremely well. A party which didn't exist a year ago polled 29% and gained 2,500 more votes than the Conservative party. And if a few hundred Labour voters had gone over to Farage we would now be telling an entirely different story. But they didn't. The Tory party is in meltdown and this seat was Brexit's for the taking, but the party's vote share was down from 38% in the European elections. Yes, they lacked an effective local ground operation and the candidate faced controversy over his business interests, but there could be a bigger issue at play: the Brexit party simply may not prove the runaway success people imagined.

Brexit needed to show it was a powerful domestic force. It should have been able to win this seat. It came close to winning. But close isn't good enough. It was a major setback.

The party's momentum has clearly not stopped – repeat, it beat the Tories – but it could have become a victim of its own success. Having won the European elections, people regard Farage's outfit as an established force and credible threat. That makes its opponents readier to mobilise against it, through increased turnout or tactical voting or both. But there could be deeper problems. European elections have never guaranteed domestic electoral success – we would have elected Tory governments in 2001 and 2005 and a Ukip one in 2015 if they had. While ballots for the European parliament have always offered a safe space for a kicking, voters take the UK parliament more seriously. More to the point, this was also a low-stakes election, in which people didn't have to worry about a new parliament or government. Perfect territory for an insurgent win, and Farage couldn't deliver.

And so to the Tories. Theresa May steps down as leader today, and Peterborough could scarcely have provided a more fitting farewell. Last night, in a seat which the Conservatives won relatively comfortably just four years ago, the party was down over 25% on its 2017 result and finished in third place.

It tells you everything you need to know about the party that they are probably breathing a sigh of relief today. The result was dismal, but the Conservative share was still up 10% from the European elections. It shows how low the bar has been set that the Tories can celebrate they weren't crushed. A party in crisis was not humiliated, and that offers a crumb of comfort.

And yet. Third place is no good. Your loyal base is not going to win you a general election, and neither is sympathy. The Tories are almost in a honeymoon period now. May hadn't resigned at the time of the European elections and now she has. A window has been opened in an airless room and the previously loyal Tories of Peterborough still didn't go anywhere near it. There are even more serious problems to come. Even though the Tories remain a force, the splintering of the vote could devastate them. We know that Farage is taking many more votes from the right than the left. A rump of ex-Tory voters will now always back the Brexit party, and so under first-past-the-post Labour could sneak into previously tight marginals despite limited public enthusiasm and a much reduced vote share. Last night the Brexit party and Tory party won over 50% of the vote next to Labour's 31%. The Conservatives' nightmare scenario is that the Brexit party seldom receives enough votes to get itself over the line, but consistently takes enough Tory votes to deliver Labour a convincing nationwide victory.

The result probably won't change much in the Tory leadership race. Some argued that Boris Johnson wanted a Farage victory so he could emphasise the Brexit party's threat. Now, he cannot prove that Farage is a dependable winner or that towns like Peterborough are going to line up behind a no-deal Brexit. In other words, he and his party remain as boxed in as ever. In the meantime, the deluded tedium continues. This morning Johnson tweeted that "Conservatives must deliver Brexit by 31st October or we risk Brexit party votes delivering Corbyn to No 10". His party likely faces a hammering in all circumstances.

Then to the explicitly pro-Remain parties. The Lib Dems and Greens polled a combined 26% in Peterborough two weeks ago, but only 15% last night. We must conclude that Brexit is not the only issue on people's minds, and there is now much less evidence that Remainers will flock to those parties over Labour. Indeed, Labour might still offer Remainers the best chance to defeat the Tories and Brexit party, which would help Corbyn's party significantly.

And so, after all that, what does any of this mean for Brexit? Corbyn has insisted that the campaign was fought and won on bread-and-butter issues such as austerity and education, and he may well be right. If Brexit had proved the be-all and end-all the Tories would also have been eliminated, and they weren't. But that doesn't mean the election changed nothing. Farage now wields less influence and Corbyn faces less pressure to change Labour's policy. In other words, the two main parties will calcify their positions further and Britain's paralysis will become stronger. On the defining issue of the age the country is still mired in a swamp of its own making and nobody knows a way out.

Jonathan Lis is deputy director of the pro-EU think tank British Influence and a political writer and commentator.

The opinions in's Comment and Analysis section are those of the author and are no reflection of the views of the website or its owners.