Speaking outside 10 Downing Street on Friday, she said it was "in the interests of the country for a new prime minister" to lead the U.K.'s Brexit process and confirmed her final day as Conservative Party leader would be June 7 — but she will continue as prime minister until a successor is chosen.
"It is and will always remain a matter of deep regret to me that I have not been able to deliver Brexit. It will be for my successor to seek a way forward that honors the result of the referendum," she said. "To succeed he or she will have to find consensus in parliament where I have not.
"The referendum was not just a call to leave the EU but for profound change in our country."
May defended her record over her nearly three years in Downing Street, on the economy, housing and the environment. But she referred to the Brexit crisis as "the biggest peace-time challenge any government has faced."
A tearful May concluded by saying: "I will shortly leave the job that's been the honor of my life to hold. The second female prime minister, but certainly not the last.
"I do so with no ill will but with enormous and enduring gratitude to have had the opportunity to serve the country I love."
Opposition Labour leader Jeremy Corbyn said that her departure was inevitable and repeated his call for a general election.
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
Her decision to resign comes after months of chaos in Parliament and speculation that she was about to be forced out amid growing discontent within her ruling Conservative Party.
The news comes as votes are being counted in the European Parliament elections in the U.K., in which the Conservatives look set for a humiliating result as Nigel Farage's Brexit Party surges.
May's departure means the race to become the new leader of the party, and therefore the prime minister, will begin soon — most likely after the state visit of President Donald Trump on June 3.
In the British political system, the ruling party can change leaders without the need for a new general election.
Former Foreign Secretary Boris Johnson, a key Brexit campaigner and the frontrunner for the job, is among those who have been quietly campaigning for the role for weeks.
A severely weakened May has struggled to unite lawmakers in her own party around the Brexit withdrawal agreement that she painstakingly negotiated with the E.U. after the U.K. narrowly voted to leave the political and economic bloc in a June 2016 referendum.
The agreement was widely criticized by both hardline Brexiteers and those campaigning to remain in the E.U. It was voted down three times in the House of Commons, where lawmakers have the final say on Brexit.
In a last-ditch effort, May on Tuesday set out the details of a slightly modified agreement — complete with the promise of a vote on whether to hold a second referendum to woo anti-Brexit Members of Parliament. But the very lawmakers she was aiming to impress quickly indicated they would yet again defeat the deal
The agreement was due to come back to the house for a fourth time in the first week of June — but by offering to resign May has conceded it has no chance of passing.
It's possible the E.U. could offer another extension, but its leaders have been clear that their patience is running out.
If there is no deal and no extension, then Britain will crash out of the E.U. without a deal — something many experts say would severely harm the economy and trigger shortages of food, medicine and basic supplies.
May is the fourth Conservative Party leader to be brought down by the question of Britain's relationship with Europe.
She took over as prime minister after David Cameron resigned the morning following the vote to leave the European Union in June 2016. After several weeks of wrangling between leadership hopefuls, May's competitors eventually bowed out, leaving her as the only candidate standing.
Whoever now succeeds May will be left with the same unsolved challenges.
The main sticking point in her Brexit deal for many lawmakers is an insurance policy designed to keep open the border between Northern Ireland, which is part of the U.K., and the Republic of Ireland, which will remain part of the E.U.
Known as the backstop, hardline Brexiteers fear that it could trap their country in E.U. trading rules forever.
They have therefore insisted on a time limit or an exit mechanism. The E.U., however, won't agree to this because of the real risk that a hard border could trigger a return to the conflict that plagued Northern Ireland for 30 years.