Theresa May has bowed to intense pressure from her own party and named 7 June as the day she will step aside as Conservative leader, drawing her turbulent three-year premiership to a close.
She made the announcement after a meeting with Graham Brady, the chair of the backbench 1922 Committee - which was prepared to trigger a second no-confidence vote in her leadership if she refused to resign.
May's fate was sealed after a 10-point "new Brexit deal" , announced in a speech on Tuesday, infuriated Tory backbenchers and many of her own cabinet - while falling flat with the Labour MPs it was meant to persuade.
The leader of the House of Commons, Andrea Leadsom, resigned on Wednesday , rather than present the Brexit bill to parliament.
A string of other cabinet ministers had also expressed concerns, including Sajid Javid, Jeremy Hunt, Chris Grayling and David Mundell.
In particular, they rejected May's promise to give MPs a vote on a second referendum as the Brexit bill passed through parliament, and implement the result - which they felt came too close to endorsing the idea.
The prime minister will remain in Downing Street, to shoulder the blame for what are expected to be dire results for her party at Thursday's European elections - and to host Donald Trump when he visits.
The 1922 Committee will set out the terms of a leadership contest, to kick off on 7 June, which is expected to last perhaps six weeks.
A Conservative leadership contest has two stages
In the first part, MPs vote for their choice of leader from all of the candidates who have been nominated. In each round of voting, the candidate with the least number of votes is eliminated from the contest. MPs then vote again, until there are only two challengers remaining. This usually takes place over several days, and candidates often withdraw from the process if they can see they have no chance of winning, which can speed it up.
At that point the second stage is a postal ballot of Conservative party members to choose, which of the two candidates they wish to lead the party.
In 2016 the party members did not get to vote. At the point where the contest had been narrowed down to a choice between Andrea Leadsom or Theresa May, Leadsom stood aside. This left Theresa May to become leader and prime minister unopposed.
The former foreign secretary Boris Johnson is the front-runner to be Britain's next prime minister; but more than a dozen senior Tory figures are considering throwing their hats into the ring.
In the cabinet, Rory Stewart has already said he will stand, while Jeremy Hunt, Michael Gove, Penny Mordaunt and Sajid Javid are all likely contenders.
May's departure came after three years of wrangling with Brexiters on her own backbenches about what future relationship with the European Union they would be prepared to accept.
That became considerably more difficult when she lost her majority at the 2017 general election, after spearheading what was widely regarded as a disastrous campaign, promising "strong and stable leadership in the national interest".
Brexit is likely to dominate the race to succeed May, with time increasingly tight for a new team to set out any new direction before the deadline of 31 October for Britain's departure from the EU.
May's longtime friend Damian Green, the former first secretary of state, defended her record on Friday.
"All prime ministers, in the end, take responsibility for what happens on their watch, but I think that it's undeniable that suddenly and unexpectedly becoming prime minister after the seismic shock of the Brexit referendum meant that she was dealt an extremely difficult hand to play. And the truth is that having an election a year later, which cut the Conservative party's majority, then [made it] impossible."
Green told BBC Radio 4's Today programme: "The fact that parliament has not been able to get a Brexit deal through has led to the impatience, bordering into contempt, for the political class and the amount of hostility and borderline violence is something we have not known for a very very long time."
Theresa May resignation: key reactions
The European Union said the resignation does nothing to change its position on the Brexit withdrawal deal agreed with Britain.
EU Commission President Jean-Claude Juncker noted May's decision "without personal joy", a spokeswoman said, adding that the council of EU leaders has "set out its position" on the Brexit deal.
The EU's chief Brexit negotiator, Michel Barnier, tweeted that he "would like to express my full respect for @theresa_may and for her determination, as Prime Minister, in working towards the #UK's orderly withdrawal from the EU".
One of the leading contenders to succeed May, Britain's former foreign minister Boris Johnson tweeted: "A very dignified statement from @theresa_may. Thank you for your stoical service to our country and the Conservative Party. It is now time to follow her urgings: to come together and deliver Brexit."
French President Emmanuel Macron hailed May for her "courageous work" in seeking to implement Brexit in the interests of her country while showing respect for Britain's European partners.
But the Elysee statement added: "The principles of the EU will continue to apply, with the priority on the smooth functioning of the EU, and this requires a rapid clarification."
"At a time of an important choice, votes of rejection that do not offer an alternative project will lead to an impasse."
German Chancellor Angela Merkel noted May's decision "with respect", saying they shared a "good and trusting" working relationship, according to her spokeswoman.
Pledging to keep working with May in the same spirit as long as she is in office, Merkel noted Berlin "wishes to maintain close cooperation and a close relationship with the British government", spokeswoman Martina Fietz said.
Fietz declined to comment on how the resignation could affect Brexit, as "the development depends essentially on domestic political developments in Britain".
'Misjudged the mood'
Anti-EU populist Nigel Farage, whose Brexit Party is leading opinion polls in Britain, blamed May for misjudging the mood of her country by trying to preserve close trade ties with the bloc.
"It is difficult not to feel for Mrs May, but politically she misjudged the mood of the country and her party. Two Tory leaders have now gone whose instincts were pro-EU," he wrote in a tweet, referring to May and her predecessor David Cameron.
'Very difficult period'
In Moscow, the Kremlin said that May's premiership has been a very difficult time for Russia's relations with Britain.
"Mrs May's stint as prime minister has come during a very difficult period in our bilateral relations," said President Vladimir Putin's spokesman Dmitry Peskov.
'Impossible to stop'
The Madrid government warned that a no-deal Brexit now appears almost inevitable.
"Under these circumstances, a hard Brexit appears to be a reality that is near impossible to stop," Spanish government spokeswoman Isabel Celaa told reporters, adding that the British government and parliament would be "solely responsible for a no-deal exit (from the EU) and its consequences".
On the financial markets, sterling briefly sank below $1.27 but did not reach the four-month lows that were plumbed a day earlier and was still higher compared to late Thursday, as dealers argued that the resignation news had already been priced in.
Stock markets mostly rebounded with US President Donald Trump offering an "olive branch" to China in their trade war, dealers said.