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.
He insisted he had taken the decision voluntarily and retained the support of his party.
He will remain in place while an election is held to choose his successor.
Possible candidates to succeed Mr Farron include Norman Lamb, who lost a leadership contest to him two years ago, former business secretary Sir Vince Cable and ex-minister Jo Swinson.
Farron quits: Reaction and live updates
Paddick quits Lib Dem frontbench role
In a hastily-arranged statement, and surrounded by his close colleagues, Mr Farron said he had been "proud" to lead the party for 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."
Tim Farron speaking
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.
Earlier on Wednesday, shadow home affairs spokesman Lord Paddick himself quit, citing concerns about Mr Farron's "views on various issues".
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.