Just weeks after the European elections, voters in England’s Peterborough constituency were back at the ballot box surrounded by the press. In December 2018 Fiona Onasanya, the Labour member of parliament for the Midlands town, was found guilty of perverting the course of justice; after being expelled by the party Onasanya announced her intention to continue on as an independent, but her constituents forced a recall petition and a by-election was called.

The news of the by-election and its date came amid the European election campaigning, and Nigel Farage’s newly founded Brexit Party announced it would stand. After the new party’s electoral land grab at the expense of Farage’s old bastion, the United Kingdom Independence Party (UKIP), the possibility of winning its first MP three months after its launch was a very realistic prospect.

The seat was volatile, too: from 1979 until 2015, aside from Tony Blair’s first two terms, the seat had been held by the Conservatives. Labour won it back in 2017 by a slim majority of 607 — symbolically, from Stewart Jackson, the special adviser and chief of staff to then-Brexit secretary David Davis. Peterborough functions as a weathervane constituency, tending to show the direction in which the political winds are shifting.

Right up until the moment the results were announced, pollsters and the media were predicting a Brexit Party win. Instead, Labour won on a reduced vote share — from 48.1 percent to 30.9 percent — but with a slightly increased margin of 683. If parties were seen purely as Leave or Remain, more of the Conservative vote should have defected to the Brexit party and Labour voters should have disembarked en masse for either the Liberal Democrats or Farage’s team. Instead both of the big parties still held a chunk of their core vote as the results were counted, which led to Labour holding the seat and the Brexit Party collecting far fewer new voters than they had anticipated, and the media expected.

For both the Brexit Party and Labour, the lessons from Peterborough are more complex and interesting than the incorrect and largely dull pre-election predictions. The Brexit Party has never just been a single-issue party. Farage’s decision to set up his new party and name it as he did was a very calculated decision — like walking away from a long-term but deeply dysfunctional relationship, he could extricate himself from its toxicity and baggage even while emerging with his own disgusting, personal brand of toxicity to carry into the next partnership.

The Brexit Party claims not to need a manifesto because they care only about an ideology. Hence the rhetorical tropes about betrayal and giving bloody noses to elites, and the political deployment of nostalgia, both as straightforward nationalism and as the promise of a better life without the hard work of developing and costing policy proposals — not to mention the dogwhistle assertion that “life was better” here because migrants weren’t.

Not winning was not necessarily a defeat for Farage, however: a publicity stunt the day after polling closed saw the leader hand-delivering a letter to Downing Street “demanding” the Brexit Party be included in future negotiations. Brexit Party activists claimed the Labour victory was due to homes “with fourteen adults registered to vote,” querying how many were born in Britain and registered for postal votes, which Labour rightly called out as a racist trope. Hundreds of Brexit Party voters across the country spread the lie that 70 percent of all votes were postal votes, when in fact the turnout rate by post was 70 percent: turnout is always higher by post, as people who request postal votes usually use them. But the trope of Asian areas having votes falsified en masse persists among racists.

Labour beat back a Brexit Party victory for several reasons: early on they expelled Fiona Onasanya from the party and began planning a campaign in the event of the by-election, stating they would push for a recount vote and encouraging local members to campaign for petition signatures. Voters were not simply voting about Brexit: Labour fought a properly local campaign focusing on manifesto policies and key services in the local council and education, but also heavily focusing on fly-tipping — the problem of illegal garbage dumping. One senior staffer told me weeks before the by-election that they were nervous about the focus on the topic, and their candidate, Lisa Forbes, knew the area well and stood for the party at the 2015 general election.

Despite media stories about membership declining, and young members being dissatisfied with Corbyn and the party, Momentum still showed themselves to be a fearsome on-the-ground campaigning force. The Tories are still also losing the digital arms race, with Labour streamlining data to target campaigning, encourage postal voters to return their ballots before the deadline, and get out the vote. A day or two before polling day, with the Conservatives struggling to catch up, they were sending peculiar, frantic emails from the Tory chairman to anyone whose email address the party had ever hoovered up.

Peterborough shows the tactics that work when it comes to a parliamentary election but also what should be feared. The European elections were, as European elections in Britain always are, in certain respects a blip in long-term electoral trends and cannot be mapped onto Westminster voting intention. But Farage’s Brexit Party poses a threat, since it is not simply a single-issue party, but a campaigning force built around xenophobia and far-right sentiment. Yet in 2017 the Labour Party and grassroots members fought a fearsomely effective campaign that worked.

Keeping to party policy on Brexit while cultivating the skills and activist numbers that helped shock the pundits in 2017 — these hold the key to any potential Labour general election victory.