Sir Keir Starmer has hailed a victory “against the odds” after Labour hung on to win in the Batley and Spen by-election.
Kim Leadbeater squeezed home by just 323 votes after a bitter and divisive campaign that many had predicted the party would lose.
The result came as a huge relief to the beleaguered Labour leader after the party’s bruising loss in the Hartlepool by-election in May.
It was also a personal triumph for Ms Leadbeater, whose sister, Jo Cox, represented the seat for Labour until her murder by a far-right extremist in 2016.
Afterwards an emotional Ms Leadbeater declared: “If I can be half the MP Jo was I know I will do her proud and I will do my family proud.”
She secured the seat – which Labour held at the 2019 general election with a 3,525 majority- with 13,296 votes, narrowly beating Conservative Ryan Stephenson on 12,973.
Veteran left-winger George Galloway – who had targeted the constituency’s Muslim voters in a campaign to topple Sir Keir – was third with 8.264.
Following a contest marked by allegations of violence and dirty tricks, Sir Keir paid tribute to Labour’s “brilliant and brave” winning candidate.
“Kim has shown inspiring resilience in the face of hatred and intimidation. She was unafraid to call it out and ran a positive campaign of hope,” he said.
“We won this election against the odds, and we did so by showing that when we are true to our values – decency, honesty, committed to improving lives – then Labour can win.
“This result shows Labour at its best. This is just the start.”
In her acceptance speech, Ms Leadbeater thanked the police “who, sadly, I have needed more than ever over the last few weeks”.
It followed reported clashes between Mr Galloway’s Workers Party and Labour supporters as they battled for votes in the constituency’s Asian communities.
At the weekend, Labour activists said they were pelted with eggs and kicked in the head, while police said an 18-year-old man had been arrested on suspicion of assault in connection with an attack on canvassers.
Ms Leadbeater was also confronted by a man who challenged her over the situation in Kashmir and her stance on LGBT education in schools amid what he said were concerns from Muslim parents.
Mr Galloway said he would take legal action to get the result set aside, claiming 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.
The result offers some breathing space to Sir Keir amid speculation about a possible leadership challenge in Westminster as the party continues to trail the Tories in the opinion polls.
Ahead of the contest his allies insisted he would not quit if Labour had lost, as deputy leader Angela Rayner was forced to distance herself from reports that her supporters were plotting a move against him.
A senior Labour source said: “Everyone’s been calling this a referendum on Keir’s leadership.
“Well, we’ve won – bucked the trend, held on to this marginal seat and advanced in Tory areas. A fantastic result.”
Conservative Party co-chair Amanda Milling said the result is “disappointing” but insisted it is not a “great win” for Labour.
“This was always going to be really a tough battle for us. Governing parties don’t tend to win by-elections. This is a Labour hold, not a Labour gain,” she told Sky News.
She acknowledged that the behaviour of Matt Hancock – who resigned as health secretary after admitting he broke social-distancing rules while kissing a close aide in his office – had been an issue in the final days of the campaign.
“It was something that came up on the doorstep, I have to be honest about that. They (voters) had some issues over the weekend in terms of what happened,” she said.