Tim Farron has said he is to step down as leader of the Liberal Democrats, less than a week after the election.
In a statement, he said he was “torn between living as a faithful Christian and serving as a political leader”.
He said he should have dealt “more wisely” with questions relating to his faith during the election campaign, including his views on gay sex.
Possible successors include former ministers Sir Vince Cable, Jo Swinson, Sir Ed Davey and Norman Lamb.
Church leaders praised Mr Farron. The Archbishop of Canterbury Justin Welby said he was “honourable and decent”.
The acting Bishop of London, Pete Broadbent, said “no-one should have to choose between their faith and politics” and it was “deeply regrettable” he felt the need to quit.
In a hastily-arranged statement, and surrounded by his close colleagues, Mr Farron insisted his decision to step down was voluntary and that he retained the support of his party, which he had been proud to lead for nearly two years.
But he said he could no longer reconcile his strong Christian faith with his responsibilities as leader of a liberal party.
“The consequences of the focus on my faith is that I have found myself torn between living as a faithful Christian and serving as a political leader,” he said.
“A better, wiser person may have been able to deal with this more successfully, to remain faithful to Christ while leading a political party in the current environment.
“To be a leader, particularly of a progressive liberal party in 2017 and to live as a committed Christian and to hold faithful to the Bible’s teaching has felt impossible for me.”
He said he was passionate about defending the rights and liberties of people who believed differently to him, but said he had been the “subject of suspicion” because of his own beliefs.
While questions about his faith were legitimate, he said they “distracted” from the party’s election campaign.
During the campaign, he was asked repeatedly in media interviews to clarify his views on gay sex but did not, to begin with, answer directly.
He later insisted that he did not believe it was a sin and that, while he believed political leaders should not “pontificate on theological matters”, it was right to address the subject as it had become “an issue”.
Earlier on Wednesday, shadow home affairs spokesman Lord Paddick himself quit, citing concerns about Mr Farron’s “views on various issues”.
As the party does not currently have a deputy leader, Mr Farron will remain in place while an election is held to choose his successor.
Mr Farron succeeded Nick Clegg in 2015 after the party’s disastrous election result, in which it lost nearly 50 seats.
Having not served in the coalition government, he positioned himself to the left of Mr Clegg and sought to rebuild the party at grassroots level.
The party increased its tally of seats from nine to 12 at last week’s election, but its vote share fell from 7.9% to 7.4%.
They were hoping to make significant headway on the back of a pledge to hold a second EU referendum.
Despite winning back seats in the south of England lost in 2015, and making gains in Scotland, the party’s national performance was patchy.
It lost its last remaining seat in Wales, Mr Clegg was defeated in Sheffield, and 375 of the party’s candidates lost their deposits after getting less than 5% of the vote.
Senior party figures and Church leaders praised their outgoing leader. Mr Clegg said it must have been an “agonising” decision for him to make.
He tweeted: “I’m sure I was not alone in being moved by the way Tim spoke about the struggle he found in balancing his faith and his politics.”
Willie Rennie, the leader of the Scottish Liberal Democrats, said Mr Farron had been a “dynamic and inspirational” leader who helped the party bounce back from the “dark days” after the 2015 election.
“I believe he still has a big role to play in British politics,” Mr Rennie added.
But former Lib Dem official Miranda Green criticised Mr Farron for making his statement on the same day as the Grenfell Tower fire tragedy in London, in which at least 12 people have died.
She said the timing showed the Lib Dem leader was “myopic and self-obsessed”.