Theresa May has announced her resignation as Conservative leader, clearing the way for a new prime minister to pick up the formidable challenge of delivering Brexit and reuniting a shattered party.
Mrs May said in an emotional statement in Downing Street that she would resign as Tory leader on Friday June 7, triggering a leadership contest that will start the following week which former foreign secretary Boris Johnson is favourite to win.
The prime minister said she would continue in a caretaker role until a new Conservative leader is elected; that process - involving Tory MPs and party activists - is expected to be wrapped up before the end of July.
Mrs May finally yielded to the inevitable in a statement in Downing Street on Friday just after 10am, following a meeting with Graham Brady, chairman of the backbench Tory 1922 committee.
Sir Graham had made it clear that she stood no chance of winning parliamentary backing for her revamped Brexit deal and had lost the confidence of her party.
The prime minister admitted on the steps of Number 10 that she had been defeated by the challenge of delivering Brexit, having surrendered her parliamentary majority in an election in 2017: "I did my best," she said.
Mrs May put her deal to the House of Commons but was defeated three times, initially by the biggest majority against a government in history, as Eurosceptics, Remainers and the Labour opposition united against her Brexit plans.
"It is a matter of deep regret that I have not been able to deliver Brexit," she said, adding that whoever succeeded her as prime minister would have to compromise and build a cross-party consensus if the UK was to leave the EU with a deal.
The prime minister, normally noted for keeping her emotions firmly hidden, became tearful as she spoke of the "honour" of leading Britain: "The second female prime minister, but certainly not the last," she said of herself.
Mrs May said her legacy would include trying to make the UK a fairer place, improving the environment, building more homes and completing the task of eliminating the budget deficit, and suggested that her successor should stick to the centre ground.
"This is what a decent, moderate and compassionate Conservative government on the common ground of British politics can deliver," she said.
The prime minister will formally resign as Tory leader on June 7 after taking part in D-Day commemorations in France and hosting Donald Trump on a state visit to the UK. The race to succeed her will officially begin immediately after that.
Gus O'Donnell, former head of the civil service, said Tory grandees had been "pointing a revolver at the prime minister's head", giving Mrs May no choice but to tender her resignation.
Senior cabinet ministers, led by foreign secretary Jeremy Hunt, on Thursday told Mrs May that they could not support her revised Brexit deal, which held open the possibility of a second EU referendum.
The Brexit saga has consumed Mrs May and her party, which faces a disastrous set of results in European Parliament elections that were held on Thursday but have yet to be declared. Dan Hannan, a Tory MEP, said he expected that not a single Conservative would be elected.
The prime minister spent Thursday night discussing the choreography of her departure with her husband Philip at their Berkshire home, before returning to Downing Street early on Friday morning.
Mrs May became prime minister in 2016, replacing David Cameron after having previously served for six years as home secretary. She promised to tackle "burning injustices" in society, but leaves office with only a scant political legacy.
Like Mr Cameron, John Major and Margaret Thatcher, Mrs May joins the list of Conservative prime ministers who were weakened or ultimately brought down by the party's fractious debate on Europe.