BY-ELECTIONS in Britain often produce shock results. But the loser is usually the incumbent party. After three awful weeks for Jeremy Corbyn, the Labour Party’s far-left leader, most pundits duly predicted that the party would do badly in the Oldham West by-election on December 3rd, and that it might even lose the seat, which the late Michael Meacher won with a majority of almost 15,000 votes in May, to the anti-European, anti-immigrant UK Independence Party (UKIP).

In the event Labour’s Jim McMahon easily held on to the seat. Indeed, his party’s share of the vote rose, from 54.8% in May to 62.2%. UKIP, which has long been forecasting a big breakthrough against Labour in northern seats like Oldham, also increased its share of the vote, but only by three points to 23.8%. Turnout was low, at just over 40%, but that is a fairly typical figure for a by-election.

Mr Corbyn’s supporters were quick to say that the result showed that he was nothing like as toxic a leader as his critics have been claiming. Debbie Abrahams, Labour MP for the neighbouring seat of Oldham East, said that as many people were praising what Mr Corbyn had done as the opposite. Tom Watson, Labour’s deputy leader, hailed the result as “very, very good for Mr Corbyn.”

Yet the Labour leader had not campaigned in Oldham West, partly because of his preoccupation with the Syria vote in the House of Commons on December 2nd. Moreover, Mr McMahon, a successful and pragmatic leader of Oldham’s council, is a centrist who is almost as far removed from the Corbynistas as anyone could be. He barely mentioned the party leader during the by-election campaign.

The UKIP leader, Nigel Farage, was also quick to cry foul. He told the BBC that he had been involved in 30 by-elections and never been so shocked by the result. He pointed the finger at a large postal vote, of around a quarter of the total, and claimed that much of it came from local residents of Bangladeshi and Pakistani origin. Mr Farage said “they can’t speak English, they’ve never heard of UKIP or the Conservative Party, they’ve never even heard of Jeremy Corbyn.” His deputy, Paul Nuttall, called postal voting an “affront to democracy” and asked provocatively: “Is this Britain or is this Harare?” UKIP plans to file an official complaint.

Whatever the truth about postal voting, UKIP now faces hard questions about its tactics in the north. The Labour electoral machine in Oldham West was simply slicker and more efficient than its rivals. The party has deep roots in the constituency. And, although some traditional Labour supporters were heard during the campaign expressing doubts about Mr Corbyn’s credibility in matters of national security, they were not numerous enough to overturn a big majority. After his defeat in the Syria vote and three weeks of relentless criticism from moderates in his party, Mr Corbyn will be happy to bask in the glow of Labour’s unexpectedly large win in Oldham West. Meanwhile the Tories will be quietly pleased, both because Mr Corbyn seems now more likely to remain and because UKIP was such a big loser.