Emily Maitlis: In the end, then, a bloody, brutal decapitation. A woman forced to metaphorically walk the plank and brought to the brink of tears. It was Theresa May herself who used that phrase - the Nasty Party. Ironic to see her fate played out by a ballot box of votes she never even saw opened. The grey suits of the men and women in shadows long plotting to bring her down. Few feel they knew this Prime Minister well. Perhaps that was the problem. Her friends were a tight bond - but there were many more left outside. So what do we know of her? And how will this extraordinary patch of British history be remembered? Michael Cockerell looks back at her time.
Michael Cockerell: Being Prime Minister is always a lonely job. But few have been lonelier at the top than Theresa May. And today, Mrs May finally surrendered to the inevitable. But it was all meant to be so different.
CLIP Theresa May: My pitch is very simple, I'm Theresa May and I think I'm the best person to be Prime Minister of this country. CHEERING AND APPLAUSE.
She won the Tory leadership on a walkover and became an immediate target for the satirists.
Jan Ravens (actress and impressionist): When she became Prime Minister, and she went out on the steps and made that speech about, you know, people who are just about managing, and, you know, people who are born poor, and all those, you know, and suddenly, she sort of revealed herself to me, and it was partly the voice and partly the sort of physicality. Because she was so held, you know, she was so tense.
So, who was this enigmatic figure who climbed to the top of the political greasy pole? She grew up an only child in Oxfordshire, her father a vicar. She went to Oxford, where one of her friends was Alan Duncan, who became one of her ministers.
Sir Alan Duncan MP: She was straitlaced, undemonstrative. Cautious. She was always... I always sensed she was a bit sort of... "I dare not say this in case I go slightly of line."
She met Philip, her husband, at Oxford, where she told friends that she wanted to be the Tories' first woman Prime Minister - but was profoundly miffed when Margaret Thatcher beat her to it. And then, she lost her parents in her 20s. Her father in a car accident, her mother shortly after from multiple sclerosis.
Chris Wilkins (former Downing Street Director of Stategy): She was in many ways potentially quite a lonely person, obviously losing her parents in the way that she did and being an only child. And I think, given that background, she has never been somebody to really sort of open up massively, or reveal much about herself. And I think that sort of impacts the way she operates quite a lot.
After Oxford, she came up against the young Philip Hammond as they both sought selection for the plum Tory seat of Maidenhead in Berkshire.
CLIP Theresa May: I think what the people here in Maidenhead were looking for was the person that they believed would be the best constituency Member of Parliament, and obviously, I think they've made the right choice tonight.
But that safe seat gave her little experience for the tough campaigns to come. David Cameron appointed her Home Secretary - traditionally the graveyard slot for aspiring prime ministers. Yet she thrived, taking a hard line on immigration and the police. But May often felt that she was being upstaged by her charismatic rival, Boris Johnson, the London Mayor. When they both went to the scene of the London riots in 2011, Mrs May, the Government's senior law and order minister, could scarcely get a word in edgeways. She left Boris to play to the crowd. And politically, she kept her head so far beneath the parapet that David Cameron would refer to her as "the Submarine".
Chris Wilkins: She will sit in a room longer than anyone else, she'll know more detail than anyone else, she will literally wait for other people to talk themselves out, and she will still be sitting there and you still won't know quite what she thinks.
Jan Ravens: We were doing Dead Ringers on the radio, and I said, we've got to do Theresa May, she is the Home Secretary, you know, there are few enough powerful women, let's do her. But of course, the trouble was, she never said anything! You know, she sort of... I think she had this policy of sort of, you know, saying nothing and waiting for the posh boys to screw it up.
CLIP David Cameron: I expect to go to the Palace and offer my resignation. We will have a new Prime Minister in that building behind me by Wednesday evening.
When the Prince of the posh boys resigned after his calamitous referendum decision, Mrs May, who had campaigned as a Remainer, was first off the mark to put her kitten heels into Cameron's shoes. At her leadership launch, she was determined to differentiate herself from the Bullingdon Boys like Boris and Dave.
CLIP Theresa May: I know I'm not a showy politician. I don't tour the television studios. I don't gossip about people over lunch. I don't go drinking in Parliament's bars. I don't often wear my heart on my sleeve. I just get on with the job in front of me. APPLAUSE
That pitch helped win her the keys to Number Ten - after the favourite, Boris Johnson, was stabbed in the back by his own campaign manager, Michael Gove. A clear omen of bloodstained troubles ahead.
Michael Cockerell: And how difficult a task or was it that she inherited, in terms of getting a withdrawal deal and getting us moving in an orderly exit? Sir Alan Duncan: It was a sort of... turbo-charged hospital pass! I mean, it is the worst set of circumstances to inherit, on coming into Number Ten.
The job in front of her was the most daunting challenge in Britain's peacetime history - to unravel 40 years of integration with Europe. It would require supreme levels of diplomacy, charm and persuasion, that were not necessarily her strongest suits.
Katie Perrior (former Downing Street Director of Communications): Half the time, these conversations take place in the corridors, and it's a quick, you know, grab them and say, "I need you on my side, don't let me down, you promised me this..." And of course, Theresa May doesn't do any of that. And so, they find a person really difficult to communicate with, they don't know where she's at, they don't really know what she wants, and they haven't seen enough of an effort to win them over.
CLIP Theresa May: During the Conservative Party leadership campaign, I was described by one of my colleagues as a "bloody difficult woman". And I said at the time, the next person to find that out will be Jean-Claude Juncker.
The President of the European Commission was less than impressed by Mrs May's approach to Brexit negotiations. Faced with deadlock, and 20% ahead of Jeremy Corbyn in the polls, she called a snap election.
CLIP Theresa May: I have only recently and reluctantly come to this conclusion.
This uncharacteristically bold decision turned out to be the biggest mistake of her career, as the campaign each day vividly displayed her shortcomings.
CLIP Theresa May: Nothing has changed. Nothing has changed.
Michael Cockerell: Why do you think that campaign went so wrong for Theresa May? Katie Perrior: Gosh, we haven't got enough hours in the day to talk about why that campaign went really wrong! But in a nutshell, we had a candidate that was not used to having the spotlight on her, that had never been the star of the show - she was made the star of the show.
Chris Wilkins: I remember one moment, midway through the campaign, in a meeting, where she said, "I just hate this campaign. I'm being told where to stand, what to say, I'm even being told what to wear."
Sir Alan Duncan: I think she made two or three mistakes. One was to think that you can have a cult of personality when you don't really have much of a personality.
She lost her majority, and her authority...
CLIP Theresa May: I will repeat what I said before.
...and even her voice.
Jan Ravens: It's her worst enemy, her voice, really. It's always giving up on her. And I think that's because she's got this voice that's diplophonic. Michael Cockerell: Diplophonic? Jan Ravens: Diplophonic. It's two voices at the same time. So it's kind of going "urgh", so if you try and do that voice, you're on your throat the whole time.
She was ritually dismembered by the EU, but insisted, like the Black Knight in Monty Python, "It's just a flesh wound." And at home, where it used to be claimed that loyalty was the party's secret weapon, now disloyalty was its default setting.
Sir Alan Duncan: The thing to remember about politics is it's 90% luck. Michael Cockerell: And how much of a lucky general do you think she's been?
Sir Alan Duncan: She's been a very unlucky general. But I don't think anybody could necessarily have done that much better. I think if any of the candidates who stood against her had won, I think it could have been far more of a helter-skelter, chaotic, disastrous journey. So, although every day has been painful, at least she's been rational.
The candidates will now get another chance. The vicar's daughter faced sexism and misogyny, but she fell short as Prime Minister not because she was a woman, but because of the woman she was.
Katie Perrior: When I criticise Theresa May, it's not because she's horrible or she's evil or she doesn't care. On the contrary, she does care. She is a caring person, she wants to do the very best by people in Britain. But she's failed to communicate that over the time.
Sir Alan Duncan: I suppose when she said, you know, to, "What's the worst thing you've ever done?" "I ran through the cornfield..." Michael Cockerell: "Through a field of wheat." Sir Alan Duncan: "I ran through a field of wheat."If you had just added the word "naked" at the end, I think we'd have all thought so much more of her.
Theresa May will very soon join the pantheon of former British prime ministers. Mrs May was a dutiful woman who had fallen among fundamentalists. Her legacy is to leave a country as divided as at any time since Cromwell.