(Bloomberg) -- An emotional Theresa May announced she will quit as Britain’s prime minister after admitting she had failed to deliver the one task that defined her time in office -- taking the country out of the European Union.

“I have done my best,” May said in a statement to cameras in the sunshine outside her Downing Street offices. “It is, and will always remain, a matter of deep regret to me that I have not been able to deliver Brexit.”

May said Britain now needs a new prime minister to take over and try to complete the task that has defeated her. She will stand down as Conservative Party leader on June 7, with a leadership contest formally beginning the following week.

There will be a crowded field for that election and the race for No.10 will be hard to predict. Party bosses hope to have a new leader in place by the end of July. The result will shape the direction of Brexit and all options -- from leaving with no deal to canceling the divorce -- are now back on the table.

May’s decision heralds the end of a turbulent, three-year premiership that’s been marked by increasingly bitter divisions within her party and across Britain over how to leave the European Union.

The U.K. was due to withdraw from the EU on March 29. But May’s inability to get the divorce deal she negotiated in Brussels approved in Britain’s deadlocked Parliament has forced her to delay exit day until October.

“I have done everything I can to convince MPs to back that deal. Sadly, I have not been able to do so,” she said.

May delivered her speech in somber tones. As she reached the end, the emotion of the occasion clearly overwhelmed her.

“I will shortly leave the job that it has been the honor of my life to hold – the second female Prime Minister but certainly not the last,” she said, her voice cracking. “I do so with no ill-will, but with enormous and enduring gratitude to have had the opportunity to serve the country I love.”

May, an intensely private politician whose mechanical answers earned her the nickname “Maybot,” finally broke down as she turned from the cameras to walk back in through the door to No.10.

Attention now switches to the leadership contest ahead. The front-runner is pro-Brexit campaigner Boris Johnson, who favors a quick, sharp break from the EU. Britain has until October 31 to agree a deal with the 27 other member states. Otherwise the risk is the country will tumble out of the EU with no agreement in place to cushion the economic blow.

To contact the reporter on this story: Tim Ross in London at tross54@bloomberg.net

To contact the editors responsible for this story: Flavia Krause-Jackson at fjackson@bloomberg.net, Emma Ross-Thomas

©2019 Bloomberg L.P.