Theresa May is to resign as Prime Minister after failing to get her Brexit deal though parliament.

May, 62, will stand down as Conservative Party leader on Friday, June 7, she confirmed in an emotional statement outside No 10 following a meeting with influential 1922 backbench committee chairman Sir Graham Brady.

She tearfully described her time in office as "the honour of my life".

A leadership race will then begin to elect a new Conservatives leader, during which time May will remain as Prime Minister.

Speaking 12 hours after polls closed in the EU elections, expected to prove extremely damaging for the Tories, May said: "It is and will always remain a matter of deep regret to me that I have not been able to deliver Brexit."

May insisted that in order to leave the EU, her successor would have to build a consensus in parliament.

"It is and will always remain a matter of deep regret that that I have not been able to deliver Brexit," the former home secretary said.

"It will be for my successor to seek a way forward that honours the result of the referendum. To succeed, he or she will have to find consensus in parliament where I have not.

"Such a consensus can only be reached if those on all sides of the debate are willing to compromise."

May's leadership was fatally damaged by the reaction to her latest Withdrawal Agreement Bill (WAB).

It offers MPs a vote on whether to hold a second referendum and a choice which could leave the UK in a temporary customs union with the EU - both measures which are unacceptable to Tory Eurosceptics.

The scale of Cabinet anger at the legislation - which led to Andrea Leadsom's resignation as leader of the House of Commons on Wednesday night - was made clear by two of Mrs May's most senior ministers.

The WAB had been due to be published on Friday but that has been delayed in a sign of the chaos at the top of the government.

First Minister Nicola Sturgeon called for a general election before a new Tory leader is allowed to become Prime Minister, and for a second Scottish independence referendum.

"I wish Theresa May well. She and I had profound disagreements - not least on her handling of Brexit and her disregard for Scotland's interests.

"However, leadership is tough - especially in these times - and she deserves thanks for her service.

"Her departure will not solve the Brexit mess that the Tories have created. Only putting the matter back to the people can do that.

"Given current circumstances, it also feels deeply wrong for another Tory to be installed in Number 10 without a general election."

Sturgeon 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."

Scottish Conservatives leader Ruth Davidson paid tribute to May and called for the next party leader to work on "bringing out country back together".

She said: "The Prime Minister has always put country before party and, by announcing her resignation and setting out a plan for an orderly departure, she has shown that commitment again today.

"Theresa May knew when she took on the job of Prime Minister that the challenges facing our country were unprecedented.

"Her time in office has been characterised by the hard work, resilience, quiet dignity and attention to detail for which she is known."

Davidson added:"On behalf of everyone in the Scottish Conservative and Unionist party I would like to thank her for her years of service as an MP, party chairman, Secretary of State, and Prime Minister.

"The party will now elect a new leader over the coming weeks.

"As leader of the Scottish Conservatives, I want to see candidates show that same level of commitment to Scotland's place in the union, an ability to advance our interests at home and abroad and, crucially, demonstrate how they intend to bring our country back together after the divisions sown by two constitutional referenda."

Scottish Secretary David Mundell said: "I am very sorry it has come to this. Nobody could have worked harder, or shown a greater sense of public duty, in delivering the result of the EU referendum than Theresa May.

"She has my utmost respect for those endeavours, in the most challenging of circumstances, as well as her unswerving commitment to the Union.

"As Mrs May herself acknowledges, she has, however unfairly, become an impediment to the resolution of Brexit, and was no longer being given a hearing by parliament.

"Yesterday's elections will surely show that delivering Brexit is now more urgent than ever, and that will fall to a new Prime Minister. It's time to get on with the process of appointing one."

May arrived in Downing Street on July 13, 2016 faced with the task of bringing together party and country after the traumas of the EU referendum.

Her premiership has been dominated by tortuous negotiations in Brussels and vicious infighting within Tory ranks over the terms on which the UK would leave.

She marked her arrival with an impassioned promise on the steps of Number 10 to tackle the "burning injustices" which hold back the poor, ethnic minorities, women and the working classes in modern British society.

But her disastrous decision the following year to hold a snap election deprived her of her slim majority in the House of Commons, leaving her dependent on the Democratic Unionist Party (DUP).

From that point on, she was engaged in a day-by-day battle to force her agenda through and maintain the fragile unity of her government.

She lost more than 30 ministers - most of them quitting over her Brexit plans - saw her keynote policy defeated by a record-breaking 230 votes and suffered the indignity of having her government found in contempt of parliament.