Theresa May has said she will quit as Conservative leader on 7 June, paving the way for a contest to decide a new prime minister.
In an emotional statement, she said she had done her best to deliver Brexit and it was a matter of “deep regret” that she had been unable to do so.
Being prime minister had been the “honour of my life”, she said.
Mrs May said she would continue to serve as PM while a Conservative leadership contest takes place.
It means she will still be prime minister when US President Donald Trump makes his state visit to the UK at the start of June.
Mrs May announced she would step down as Tory leader on 7 June and had agreed with the chairman of Tory backbenchers that a leadership contest should begin the following week.
Boris Johnson, Esther McVey and Rory Stewart have said they intend to run for the party leadership, while more than a dozen others are believed to be seriously considering entering the contest.
The prime minister has faced a backlash from her MPs against her latest Brexit plan, which included concessions aimed at attracting cross-party support.
Andrea Leadsom quit as Commons leader on Wednesday saying she no longer believed the government would “deliver on the referendum result”.
Mrs May met Home Secretary Sajid Javid and Foreign Secretary Jeremy Hunt at Downing Street on Thursday where they are understood to have expressed their concerns about her proposed withdrawal bill.
In her statement on Friday, she said she had done “everything I can” to convince MPs to support the withdrawal deal she had negotiated with the European Union but it was now in the “best interests of the country for a new prime minister to lead that effort”.
She added that, in order to deliver Brexit, her successor would have to build agreement in Parliament.
“Such a consensus can only be reached if those on all sides of the debate are willing to compromise,” she said.
Mrs May’s voice shook as she ended her speech saying: “I will shortly leave the job that it has been the honour 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.”
Labour Leader Jeremy Corbyn said she had been “right to resign” and that the Conservative Party was now “disintegrating”.
A series of Conservative MPs praised Mrs May following her statement.
Foreign Secretary Jeremy Hunt said she was a “true public servant”:
Chief whip Julian Smith praised her commitment to the country as “outstanding”:
And Chancellor Philip Hammond said it had been a “privilege” to serve alongside her:
Scotland’s First Minister Nicola Sturgeon wished her well despite “profound disagreements”, including on Brexit, but added: “The prospect of an even more hardline Brexiteer now becoming PM and threatening a no-deal exit is deeply concerning.
“Added to the experience of the past three years, this makes it all the more important that Scotland is given the choice of becoming an independent country.”