Liberal Democrat leader Tim Farron has quit, blaming "suspicion" of his religious beliefs.
Farron said he had found it "impossible" to be the leader of a liberal party and a committed Christian at the same time.
"I seem to be the subject of suspicion because of what I believe and who my faith is in," he said in a speech at the party's London HQ.
"In which case we are kidding ourselves if we think we yet live in a tolerant, liberal society. That’s why I have chosen to step down as leader of the Liberal Democrats."
The start of the Lib Dem general election campaign was dogged by Farron's repeated refusals to say whether or not he believed gay sex was a sin.
While he eventually went on record to say he did not believe that, the damage, it seemed, was already done.
A Lib Dem source close to Tim Farron told BuzzFeed News that the party leader made the decision to quit on his own this afternoon.
“His job was to rebuild the party, he’d done the job, and he decided time to let someone else take the next chapter," they said.
As recently as this lunchtime Farron was issuing statements about the future of the party, including announcing the start of a contest for deputy leader, which he suggested should be won by a female MP to produce a gender-balanced leadership team.
But shortly afterwards the Lib Dems’ former mayor of London candidate Lord Paddick, who is gay, resigned his front bench position. He said he could no longer support Farron following his comments on the campaign trail.
By 6pm Farron had decided to resign, written a resignation speech, and told staff at party HQ that he was leaving.
The favourite to replace him as leader of the party is newly re-elected Scottish Lib Dem MP Jo Swinson, who served as a minister in the coalition government but lost her seat in the party’s 2015 bloodbath campaign.
During the campaign Swinson had made it known on the campaign trail that she was willing to stand for leader but the source close to Farron refused to comment on whether they blamed her for the apparent coup attempt.
“Jo can answer for Jo,” they said
Farron, who took up the Lib Dem leadership following the party's near obliteration in the 2015 election, saw his party increase its seats in the Commons to 12 last Thursday.
But the party did not achieve the recovery it had hoped for by pitching a new opposition that would campaign to stay in the European Union.
He himself meanwhile defended his own Westmorland and Lonsdale seat by just 777 votes.
Many of the target seats it failed to win were in highly Leave-leaning areas.
Former Lib Dem MP for St Ives Andrew George, who during the election campaign told BuzzFeed New that he believed pro-EU Farron may stand in the way of him winning back his Leave-leaning seat – which was eventually retained by Conservative Derek Thomas – thought Farron had done the right thing by standing down today.
"He's a decent chap who did his best in difficult circumstances, however he could not have plausibly led our party into the next election," George told BuzzFeed News.
But George questioned Farron's reason for standing down. "He should not have felt bullied into resigning because he has a faith," he added.
Read Tim Farron's resignation statement in full here:
This last two years have seen the Liberal Democrats recover since the devastation of the 2015 election.
That recovery was never inevitable but we have seen the doubling of our party membership, growth in council elections, our first parliamentary by-election win for more than a decade, and most recently our growth at the 2017 general election.
Most importantly the Liberal Democrats have established ourselves with a significant and distinctive role – passionate about Europe, free trade, strong well-funded public services underpinned by a growing market economy.
No one else occupies that space. Against all the odds, the Liberal Democrats matter again.
We can be proud of the progress we have made together, although there is much more we need to do.
From the very first day of my leadership, I have faced questions about my Christian faith. I've tried to answer with grace and patience. Sometimes my answers could have been wiser.
At the start of this election, I found myself under scrutiny again – asked about matters to do with my faith. I felt guilty that this focus was distracting attention from our campaign, obscuring our message.
Journalists have every right to ask what they see fit. 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.
A better, wiser person than me may have been able to deal with this more successfully, to have remained faithful to Christ while leading a political party in the current environment.
To be a political leader – especially of a progressive, liberal party in 2017 – and to live as a committed Christian, to hold faithfully to the Bible's teaching, has felt impossible for me.
I'm a liberal to my fingertips, and that liberalism means that I am passionate about defending the rights and liberties of people who believe different things to me.
There are Christians in politics who take the view that they should impose the tenets of faith on society, but I have not taken that approach because I disagree with it – it's not liberal and it is counterproductive when it comes to advancing the gospel.
Even so, I seem to be the subject of suspicion because of what I believe and who my faith is in.
In which case we are kidding ourselves if we think we yet live in a tolerant, liberal society.
That's why I have chosen to step down as leader of the Liberal Democrats.
I intend to serve until the parliamentary recess begins next month, at which point there will be a leadership election according to the party’s rules.
This is a historic time in British politics. What happens in the next months and years will shape our country for generations.
My successor will inherit a party that is needed now more than ever before. Our future as an open, tolerant and united country is at stake.
The cause of British liberalism has never been needed more. People who will fight for a Britain that is confident, generous and compassionate are needed more than ever before.
That is the challenge our party and my successor faces and the opportunity I am certain that they will rise to.
I want to say one more thing: I joined our party when I was 16, it is in my blood, I love our history, our people, I thoroughly love my party.
Imagine how proud I am to lead this party. And then imagine what would lead me to voluntarily relinquish that honour.
In the words of Isaac Watts it would have to be something "so amazing, so divine, (it) demands my heart, my life, my all".