Jo Swinson will step down as Liberal Democrat leader after losing her seat to the SNP by 149 votes.
Ms Swinson, who started the campaign saying she could become the next prime minister, gained 19,523 votes compared to 19,672 for the SNP’s Amy Callaghan in Dunbartonshire East.
Sir Ed Davey and Baroness Sal Brinton will be acting leaders for the party, now she is no longer an MP.
Ms Swinson said the election results would bring “dismay” for many.
Under party rules the Lib Dem leader must have a seat in the Commons. A leadership contest will be held in the new year.
The party currently has 11 seats – with two seats still to declare.
Sal Brinton, president of the Liberal Democrats said: “I want to thank Jo Swinson for her honest and fearless leadership of the Liberal Democrats.
“In this election, we gained more votes than in 2017 and we have been joined by many new MPs.
“In the weeks ahead we will elect a new leader and our party will continue to be the rallying point for anyone who believes in a country where everyone has the chance to get on in life.”
Prior to the election, the party’s ranks had grown to 18 following defections of MPs from other parties, including Chuka Umunna and Sam Gyimah.
They were not re-elected.
The Conservatives have now secured a majority, with Labour suffering heavy losses and the SNP making big gains in Scotland.
On a disappointing night for the Lib Dems, one highlight was the party’s candidate in Richmond Park, Sarah Olney, winning the seat from the Conservatives’ Zac Goldsmith.
- WHO WON, WHERE? All the results in full
- MAPS AND CHARTS: The election in graphics
- AT A GLANCE: A quick guide to election night
Speaking at the count in Bishopbriggs, outside Glasgow, Ms Swinson said: “These are very significant results for the future of our country and I will be making further remarks later today.
“But let me say now, for millions of people in our country these results will bring dread and dismay and people are looking for hope.
“I still believe we as a country can be warm and generous, inclusive and open and that by working together with our nearest neighbours we can achieve so much more.
“Liberal Democrats will continue to stand up for these values that guide our Liberal movement – openness, fairness, inclusivity. We will stand up for hope.”
The SNP’s Ms Callaghan told BBC Scotland she was “delighted” to have unseated the Liberal Democrat leader.
The new MP said: “It’s quite a momentous achievement, both for me personally but also in terms of the people of East Dunbartonshire, completely rejecting the politics of austerity and also giving the people a chance to choose their own future, I think that is incredibly important.”
Ms Swinson became her party’s first female leader in a landslide victory over Sir Ed Davey earlier this year, succeeding Sir Vince Cable.
She had served as a minister in the coalition government and was among the party’s MPs who paid the price for the tie-up with David Cameron’s Tories in the 2015 election – which saw the Lib Dems reduced to a rump of just eight in the Commons.
Ms Swinson fought back when then prime minister Theresa May called another election in 2017, and she regained her Scottish seat from the SNP.
She attracted criticism from some quarters for her policy to revoke Article 50 and cancel Brexit, and for her previous record in the coalition government.
This is the UK’s third general election in less than five years – and the first one to take place in December in nearly 100 years – and has been dominated by Britain’s 2016 vote to leave the European Union.
The Lib Dems backed Boris Johnson’s call in October for an early election, arguing it was the best way of stopping Brexit.
Mr Johnson focused relentlessly on a single message – “get Brexit done” – promising to take the UK out of the EU by 31 January 2020 if he got a majority.
If you cannot see the lookup tool, click here.