The Labour Party has held on to the constituency of Batley and Spen in a tense by-election that threatened to push another of the party’s stronghold seats to Boris Johnson’s Conservatives.

Sir Keir Starmer’s party won in Batley on Friday morning with a tiny majority of 323, a huge reduction the previous Labour majority of 3,525 under the former MP Tracey Brabin.

Opinion polls had suggested that Labour would lose the seat in the face of a strident anti-Starmer campaign from the Left-wing firebrand candidate George Galloway and waning support for Labour among Muslim voters.

It was thought that a “vaccine bounce” in favour of the Conservatives, plus Mr Galloway’s appeal to the constituency’s sizable Indian and Pakistani populations could have removed the seat from Labour for the first time since 1997.

Labour’s candidate, Kim Leadbeater, is the new MP for Batley and Spen and follows in the footsteps of her sister Jo Cox, who was the area’s MP until she was murdered during the 2016 EU referendum by a far-Right extremist.

The Conservative candidate, Ryan Stephenson, won 12,973 votes in Thursday’s by-election, while Mr Galloway and his Workers’ Party won 8,264, coming third.

Batley and Spen result embed [DON’T USE UNTIL DECLARED!!]

Sir Keir has praised Ms Leadbeater, saying it was a "fantastic result for the brilliant and brave" candidate. 

"Kim ran a positive campaign of hope, in the face of division," he said. "She will be an outstanding Labour MP for Batley and Spen."

Brendan Cox, the widower of Jo Cox, tweeted: "We are all incredibly proud of @kimleadbeater today and Jo would have been too. While the result between the two main parties was close the extremists & haters were left trailing. The people of Batley & Spen have voted for decency and positivity once again."

Close win holds off Starmer’s enemies – for now

On Friday morning as the candidates gathered to wait for the declaration, the bundles of ballot papers were checked twice – indicating how close the result was.

The campaign became tense in recent days after several Labour figures were rumoured to be preparing leadership bids to take on Sir Keir in the event of a Tory victory.

Dawn Butler, the Labour MP for Brent Central, and the party’s deputy leader Angela Rayner both denied suggestions they had been attempting to shore up support for a leadership challenge if Batley had turned blue.

Several voices on the Labour Left, including the Corbynite MP Diane Abbott, had told Sir Keir he should stand down if he could not win the seat. She said any loss would be “curtains” for his tenure.

Other MPs in the Socialist Campaign Group, a caucus of Left-wing figures, privately told The Telegraph they would support a bid to remove Sir Keir.

Starmer looked likely to face a leadership challenge had he lost in Batley

Credit: PA

The Batley and Spen by-election was triggered by the election of Ms Brabin as the West Yorkshire mayor in the “Super Thursday” elections in May.

That round of votes also saw Labour lose Hartlepool, a key Red Wall seat in the North East.

Another by-election in Chesham and Amersham last month saw Labour garner just 1.6 per cent of the vote, losing its deposit.

The party’s victory in Batley will shore up Sir Keir’s leadership and stave off attempts to usurp him, but may not eradicate the view that he has made several strategic errors since inheriting his role from Mr Corbyn in early 2020.

Sir Keir’s critics point to the decision to select Paul Williams, a Remain-voter, in Hartlepool and his sign-off of Ms Brabin’s West Yorkshire mayoralty bid as evidence his leadership is failing.

On Thursday night, Labour sources went into the vote count in Batley and Spen expecting a loss.

George Galloway at the count on Friday morning

Credit: PA

One suggested the count would be a “long night”, and pointed to a collapse in support in key areas of the constituency as evidence that Mr Galloway’s bid to undermine Sir Keir had been successful.

Mr Galloway, a former Labour MP who was expelled for bringing the party into disrepute in the early 2000s, said his main goal was to force Sir Keir out by demonstrating that Muslims in Batley and Spen had abandoned his party.

He campaigned strongly in favour of Palestine during the campaign, while suggesting that the Labour leadership had equivocated on the conflict.

Galloway pledges to fight result in court

The Batley campaign was marred by violence on the doorstep, with some Labour campaigners reporting that they had been egged and kicked in the head by protesters while leafleting.

Ms Leadbeater was chased along a street in Batley by an anti-LGBT protester and described herself as “intimidated” by the tactics of her opponents.

Mr Galloway’s campaign denied any involvement in violent or intimidatory campaigning and said he would apply to have the result set aside by the courts.

Speaking outside the count, he said his election effort had been damaged by a "false statement" that he had laughed while Ms Leadbeater was abused on the campaign trail.

"The whole election campaign was dominated by lazy and false tropes about our campaign, about the thousands of people that voted for us, about their motives for doing so, in a way which defamed them as much as it defamed me," he said.

"So on multiple grounds we will apply to the courts for this election result to be set aside."