Labour has won the Holborn and St Pancras by-election, seeing off a challenge from Green Party leader Zack Polanski.
Camden council leader Sagal Abdi-Wali held the north London seat for Labour, but the party's majority was reduced from 11,572 to 3,364.
At a victory rally, Abdi-Wali told supporters: "People voted for hope and now we're going to be able to deliver for them."
The by-election, which was triggered after former Prime Minister Sir Keir Starmer stood down as an MP, had been seen as a key test of whether Labour under Andy Burnham can win over voters who have switched to the Greens.
Speaking to BBC Breakfast after his defeat, Polanski said the result proved his party was "more of an electoral threat in these seats than we've ever been before".
"This is the foundation we're looking to build on," he added.
He insisted he would stay on as leader despite the result. Polanski is under pressure over his response to a policy motion passed by members at his party's conference that declared Zionism a form of racism.
In her victory speech at the count in Camden, Abdi-Wali, who came to the UK as a child refugee from Somalia, said her victory was a testament to the success of diversity in the borough.
Later, speaking at a rally alongside Labour Party deputy leader Lucy Powell, she thanked voters for making her the MP "for this constituency that has given me so much".
"It gave me a community, gave me a home, gave me an opportunity, gave me an education, gave me so many of my friends - everything I am today has been shaped by it."
She told supporters that as an MP she would campaign on ending homelessness and taking Thames Water into public ownership.
Prime Minister Andy Burnham congratulated Abdi-Wali on a "fantastic campaign" while Burnham's predecessor Sir Keir said she was "a brilliant champion for our communities".
Asked what had gone wrong for his party, Polanski said the Greens had increased their vote share in the seat since the last election, describing the result as "our second best by-election result in Green Party history".
"I'm not going to sit here and pretend I'm not disappointed. No politician runs in a by-election and doesn't want to win," he told BBC Radio 4's Today.
"But at the same time, to see the growth in what was supposedly a safe Labour seat since 1983 [and] is now a marginal Labour seat, that's clearly growth and next time we can get it over the line."
Speaking to broadcasters earlier in the day, Polanski dismissed suggestions his leadership was under threat, saying: "Of course I can carry on as leader of the Green Party."
He said voters had been "excited about our plans for rent controls, tackling the climate crisis and nationalising Thames Water".
The Greens had hoped they could overturn Labour's substantial majority in the constituency after the party made gains in local elections in the area in May.
It saw a surge in support after Polanski took over as leader in September last year but in recent months polls suggest this has waned.
Earlier, former party leader Caroline Lucas told the BBC Polanski had failed to show leadership over the motion, passed by party members, which said Zionism was a form of racism.
Speaking after polls closed but before the result of the by-election was announced, Lucas criticised Polanski for not taking part in the debate or voting on the motion at the Green Party's conference in Brighton on Sunday, describing the motion as "dangerous" and "divisive".
Asked if Polanski should stand down, she said: "I think let's just see what happens in the coming days and weeks.
She continued: "I want him to speak now about what's happened, I want him to show the leadership that was frankly missing on Sunday.
"I think the jury is out about whether he will do that - but I very much hope he will."
The motion defined Zionism as an ideology supporting "an ethnonationalist Jewish state" and backs a "single democratic Palestinian state in all of historic Palestine", which includes modern-day Israel.
Polanski was not present for the vote on the motion, after leaving the conference early to campaign in Holborn and St Pancras.
Extracted and lightly reformatted for readability. · Source: pt
