Prime Minister Theresa May's government suffered a rebuke over its plans to pull Britain out of the EU on Friday after voters in the London suburb of Richmond ousted a eurosceptic lawmaker in favour of a pro-European candidate.
In a stunning upset, Liberal Democrat candidate Sarah Olney overturned a large majority to defeat Zac Goldsmith, who had held the seat for May's Conservative party since 2010, in a battle that became a mini-referendum on Brexit.
"Our message is clear: we do not want a hard Brexit," Olney said as she became her party's ninth MP with 49.68 percent of the vote, compared to 45.15 percent for Goldsmith.
"We do not want to be pulled out of the single market, and we will not let intolerance, division and fear win."
Goldsmith had resigned in protest at the government's decision to back a new runway at London's Heathrow airport, prompting a by-election in which he stood as an independent, although with Conservative support.
The Lib Dems, who had previously held the seat, sensed an opportunity to win it back by focusing on Goldsmith's support for Brexit, which was at odds with most of his constituents.
Flooding the area with campaigners, they highlighted their demands for Britain to stay in the single market and for a second referendum on the final terms of Brexit.
"That message has been resoundingly backed by the people of Richmond Park," said party leader Tim Farron.
The Conservative party did not field a candidate in Thursday's by-election and offered its "commiserations" to Goldsmith, who had been re-elected only last year with a 23,000 majority.
A spokesman said: "This result doesn't change anything.
"The government remains committed to leaving the European Union and triggering Article 50 (beginning the formal exit process) by the end of March next year."
Visibly downcast, Goldsmith acknowledged the result with a brief statement that defended his decision to resign over Heathrow's expansion, which is strongly opposed in west London due to noise and pollution concerns.
But the importance of Brexit was highlighted by the endorsement of his campaign by the UK Independence Party (UKIP), a leading force in securing the vote to leave the European Union in the June referendum.
In that vote, 52 percent of Britons nationwide voted out, while 69 percent of voters in Richmond Park opted to stay in.
The defeat caps a tough year for Goldsmith, an environmental campaigner and son of the late tycoon financier Jimmy Goldsmith, who founded the now defunct anti-European Referendum Party.
The 41-year-old lost his bid to become mayor of London in May in a bitter and divisive campaign that saw his party try to paint Labour's Muslim candidate Sadiq Khan as an extremist.
Olney, 39, is a newcomer to politics -- an accountant who joined the Lib Dems only in May 2015.
But her victory is a huge boost for the party, which was almost destroyed in last year's general election after five years in coalition government with the Conservatives.
"The message is clear: the Liberal Democrats are back and we are carrying the torch for all of those who want a real opposition to this Conservative Brexit government," Farron said.
The turnout was unusually high for a by-election, at 53.6 percent.
The government is currently fighting a legal challenge to prevent parliament having the final say on when Article 50 is triggered, but Olney said that if there is a vote, she will block the move.
"That's been a central part of my campaign and now I've been given a very clear mandate that that's what they want me to do," she told BBC News.
The High Court ruled last month that parliament must have a vote but the government has appealed to the Supreme Court, which will begin hearing arguments on Monday.