Jo Swinson has said she is "proud" to have been the first woman to lead the Liberal Democrats as she prepares to step down as party leader.
Ms Swinson, who lost her seat to the SNP's Amy Callaghan, said she was "devastated" by the election result.
Addressing supporters in London, she warned of a growing tide of populism and urged her party to "regroup". The Lib Dems dropped from 12 to 11 seats.
Sir Ed Davey and Baroness Sal Brinton will take over as acting co-leaders.
"I'm proud to have been the first woman to have led the Liberal Democrats. I'm even more proud that I will not be the last.
"One of the realities of smashing glass ceilings is that a lot of broken glass comes down on your head", she added.
She spoke of the experience of current Lib Dem spokeswomen Layla Moran, Christine Jardine, Wera Hobhouse and Sarah Olney, as well as welcoming the party's newly-elected female MPs.
She said she was "proud" that the Lib Dems advocated remaining in the EU, telling supporters: "Obviously it hasn't worked. And I, like you, am devastated about that, but I don't regret trying."
Ms Swinson said the UK was in the "grip of populism, with nationalism resurgent in all its forms", but encouraged people to remain hopeful, adding there will be a "way out of this nationalist surge".
During the last parliament, the Lib Dems welcomed MPs who defected from other parties, including Chuka Umunna and Luciana Berger from Labour, and the former Tory minister Sam Gyimah.
However, all three were defeated. Ms Swinson apologised for not being able to get them elected.
She criticised the leaders of both Labour and the Conservatives, saying voters were forced to choose the "least worst option".
Ms Swinson said that racism had become mainstream, criticising Labour's stance on anti-Semitism and accusing the Conservatives of "failing on Islamophobia".
The outgoing Lib Dem leader started the campaign saying she could become the next prime minister, but she lost her Dunbartonshire East when Ms Callaghan won 19,672 compared to her 19,523 votes.
SNP leader Nicola Sturgeon was caught on camera celebrating Ms Swinson's defeat.
Ms Sturgeon has since apologised for cheering while the election result was read out, telling Sky News she "got overexcited" at the performance of the SNP.
Ms Sturgeon has offered her commiserations to Ms Swinson on a personal level, saying she had a great deal of sympathy for her.
In her closing remarks, Ms Swinson said: "Next week is the shortest day. We will see more light in the future. Join us for that journey. Let's explore the way together with hope in our hearts."