Witney by-election: Tory majority slashed in David Cameron's former seat
The Conservatives have held ex-PM David Cameron's former seat of Witney in a by-election, but with a majority reduced by more than 20,000 votes.
Robert Courts won by 5,702 votes, with the party's vote share falling from 60% in 2015 to 45%, as the Lib Dems surged past Labour into second.
Liz Leffman polled 11,611 votes as the Lib Dems' share rose from 7% to 30%.
Meanwhile, Labour's Tracy Brabin held the Batley and Spen seat where Jo Cox was MP before she was killed in June.
The former Coronation Street actress received an 85% share of the vote in the seat, which was not contested by other major parties out of respect for Mrs Cox, who was shot and stabbed in her West Yorkshire constituency.
Mr Courts, a barrister and local councillor, saw the Tory majority cut from the more than 25,000 Mr Cameron won in the Oxfordshire seat at last year's general election.
- Analysis: How significant is Witney result?
- Batley win is victory for 'hope and unity'
- Lib Dems reduce Witney Tory stronghold
Labour's Duncan Enright dropped to third in the face of the Lib Dem resurgence.
He secured 5,765 votes, just under 15% - down slightly from the 17% Labour had at the general election.
Mr Courts paid tribute to Mr Cameron as "a great prime minister and a brilliant MP" for the constituency, saying he would strive to "help and represent local people".
The by-election was called after Mr Cameron stood down as an MP following June's Brexit vote and is the first electoral test for the Conservatives since Theresa May succeeded him as prime minister in July.
Mr Courts had enjoyed some heavyweight support on the campaign trail, with both Mr Cameron and Mrs May knocking on voters' doors.
The former prime minister, who had represented the constituency since 2001, congratulated his successor tweeting that he would be a "great MP".
'Back in big time'
Home Office minister Brandon Lewis said it was a "great result" for the Conservatives, which have held the seat ever since it was created in 1983, despite the reduced majority.
"You have to really look at what David Cameron got...when he first stood, which was 45%," he told the BBC.
Labour leader Jeremy Corbyn had also visited the constituency to support Mr Enright, while Lib Dem leader Tim Farron had been out to meet voters and back Ms Leffman.
Mr Farron said the Lib Dem resurgence signalled that the party was "back in the political big time" and represented a "return to three-party politics".
"This was the 10th safest Tory seat in the country with a massive 25,000 majority, yet the Conservatives were seriously rattled," he said.
Speaking to the Today programme, Labour Deputy Leader Tom Watson suggested the Lib Dem campaign had been "almost cruel" to the 100 peers it had sent to campaign in Witney for a by-election he said they "knew they wouldn't win."
Mr Watson played down his party's third-place result, saying Labour had been "highly, highly unlikely to win."
The focus for his party, he added, had been to build a local government base and to work with the many new Labour members in the constituency.
'Bittersweet victory in Batley and Spen'
In Batley and Spen, Mrs Cox's friend, Mrs Brabin, held the seat for Labour with an increased majority as the Conservatives, Lib Dems, UKIP and the Greens did not stand a candidate.
Mrs Brabin received 17,506 votes - 85.84% of the vote and a majority of 16,537.
Mrs Cox had been elected in 2015 with a majority of more than 6,000 votes - a 43% share. The Conservatives came second and UKIP third.
Mrs Brabin, who was loudly heckled by some during her acceptance speech, said her victory was "bittersweet", adding that she hoped Mrs Cox would be proud that the community had spoken with one voice.
"This has been a difficult experience for all of us... that this by-election has had to take place at all is a tragedy," she said.
She was one of 10 candidates, who included some independents, English Democrats, BNP and National Front candidates.
The remaining nine candidates all lost their £500 deposits as they did not receive a big enough share of the vote.
Mrs Cox's husband, Brendan Cox tweeted his congratulations to Mrs Brabin, saying: "Well done @Tracy4MP & great to see all the purveyors of hate lose their deposits #MoreInCommon."
Mrs Brabin, who played Tricia Armstrong in Coronation Street in the 1990s, before appearing as Roxy Drake in EastEnders and Carole in Emmerdale, has also written for shows including Family Affairs, Tracy Beaker and Hollyoaks.
A man has been charged with murdering Mrs Cox and is awaiting trial.