A huge upset has been pulled off by the Liberal Democrats, with Sarah Olney defeating Zac Goldsmith in the Richmond Park and North Kingston by-election.

Lib Dem challenger Ms Olney overturned Mr Goldsmith's 23,015 majority to win by 1,872 votes.

The Lib Dems poured resources into the contest as they successfully switched the focus of the campaign to Brexit in the staunchly Remain seat after Mr Goldsmith quit as a Tory MP to force the by-election so he could run as an anti-Heathrow expansion independent. 

The result saw Ms Olney poll 20,510 votes to Mr Goldsmith's 18,638, on a turnout of 41,367, or 53.6 per cent.

The 21.74 per cent swing to the Lib Dems from Mr Goldsmith topped the 19.3 per cent swing the Lib Dems achieved from the Tories in the Witney byelection.

MORE: Richmond reacts to Sarah Olney's shock by-election win over Zac Goldsmith

The Lib Dem victor, who took 49.7 per cent of the vote, said the outcome had sent a "shockwave" through Downing Street and paved the way for Parliament to "override" the EU withdrawal referendum result.

She told Sky News: "It does look now as if we can have a vote in Parliament that might override the referendum. And I will, obviously, be voting to Remain because that is always what I have believed."

Asked if she would actively resist Brexit as an MP, she said: "Absolutely. Now I've been given this mandate."

Ms Olney said the dramatic victory was a rejection of the "Ukip vision" of Britain, and the politics of "anger and division".

In her victory speech the Lib Dem said: "The people of Richmond Park and North Kingston have sent a shockwave through this Conservative Brexit government, and our message is clear: we do not want a hard Brexit. We do not want to be pulled out of the single market, and we will not let intolerance, division and fear win."

Ms Olney told the Press Association victory seemed a possibility only in the final stages of the campaign, saying: "We didn't expect until very late on to actually win."

Pressed on the first things she will begin working on as an MP, she said: "Brexit and Heathrow were the two key things we fought this campaign on, so those are the two priorities when I get into Parliament."

MORE: MP for Carshalton and Wallington Tom Brake says win by Lib Dems' Sarah Olney was thanks to Brexit

In a brief acknowledgement of the result, a clearly downcast Mr Goldsmith said: "This by-election that we have just had was not a political calculation, it was a promise that I made and it was a promise that I kept."

Labour's Christian Wolmar lost his deposit as he trailed a distant third with 1,515 votes, after the Greens backed the Lib Dem candidate, while Ukip stood aside to give Mr Goldsmith a clear run, and the Tories did not field a standard bearer.

A Conservative Party spokesman said the result would make no difference to Brexit plans, stating: "This result doesn't change anything. The Government remains committed to leaving the European Union and triggering Article 50 by the end of March next year.

"In addition, we will continue to take decisive action in the national interest to secure the UK's place the world - supporting a third runway at Heathrow to secure jobs and business opportunities for the next decade and beyond.

"Commiserations to Zac Goldsmith on his defeat. We are sorry that he is no longer in the House of Commons." 

Lib Dem leader Tim Farron said: "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. 

"This was a remarkable, come-from-nowhere upset that will terrify the Conservatives. A year and a half ago, their man won by nearly 40% and had a majority of more than 20,000. In one fell swoop we have wiped that out completely. 

"If this was a general election, this swing would mean the Conservatives would lose dozens of seats to the Liberal Democrats - and their majority with it.

Mr Wolmar said voters had disliked Mr Goldsmith's "ghastly, disgusting" bid to be London Mayor in which Labour accused him of running a racist campaign against Sadiq Khan.