EU leaders have agreed a plan that would delay Brexit from 29 March to 22 May on condition that MPs approve Theresa May's withdrawal deal next week, the European Council has confirmed.
The offer was agreed at an EU leaders’ summit in Brussels tonight.
Mrs May will have to try and get the Withdrawal Agreement through parliament next week. If she succeeds, Article 50 will be extended until 22 May, the day before the European Elections.
If she fails, then the UK will have until 12 April to decide whether or not it wanted to contest those elections, which it would have to do if it was still a member, or leave without a deal.
Following tonight's summit, European Council President Donald Tusk outlined the offer on Twitter:
EU27 responds to UK requests in a positive spirit and:— Donald Tusk (@eucopresident) March 21, 2019
👉 agrees to Art. 50 extension until 22 May if Withdrawal Agreement approved next week
👉 if not agreed next week then extension until 12 April
👉 approves ‘Strasbourg Agreement’
👉 continues no-deal preparations
European Commission President Jean-Claude Juncker said: "Since the day of the referendum the position of the 27 members of the European Commission has been united and unequivocal.
"We have worked tirelessly to negotiate the Withdrawal Agreement. We have done everything we could to get it over the finishing line.
"We were asked for clarifications in December, we gave it to them. We were asked for assurances in January, we gave it to them.
"I was asked for further reassurances last Monday in Strasbourg, notably with regard to the backstop, I gave it to them.
"So I have to welcome that today, the 27 leaders endorsed the legally bonding clarifications and assurances that Prime Minister May and I agreed in Strasbourg.
"This closes and completes the full package. There is no more that we can have."
Mr Tusk said the European Council's decision envisaged two scenarios, one in which the Withdrawal Agreement is passed next week, and one in which is is not.
He said: "In regards to the extension our decision envisaged two scenarios.
"In the first scenario, that is if the agreement is passed next week, the European Council agrees an extension to May 22.
"In the second scenario, if the agreement is not approved, the European Council agrees an extension until April 12 while expecting the UK to indicate a way forward.
"What this means in practice is that until that date all options remain open."
When asked about the mood during the talks, Mr Tusk said: "The atmosphere was much better than I expected and it was better than in December, not only because of the weather but also because of the mood.
"But frankly speaking, the mood is not the most important thing here. Our discussion was really, really constructive."
When asked whether the "special space in hell" for people who promoted Brexit without a plan should be enlarged if MPs vote down the withdrawal agreement next, Mr Tusk said there were still lots of spaces.
He added: "According to our pope, the hell is still empty. It means that there are a lot of spaces."
Mr Juncker added: "Don't go to hell."
The 'moment of decision' - Theresa May
Welcoming tonight’s developments, Mrs May said if parliament does not pass her deal next week the European Council will extend Article 50 to 12 April when the UK would have the choice of no deal or to put forward an alternative plan.
She said if this involved another extension then the country will have to take part in the European Parliament elections.
Mrs May added: "I believe strongly it would be wrong to ask people in the UK to participate in these elections three years after voting to leave the EU.
Speaking at a news conference in Brussels, she said the EU Council's approval of the legally binding assurances in relation to the Northern Ireland backstop, which were negotiated with Mr Juncker last week was welcome.
She said this should give extra assurance to parliament that in the "unlikely event" that the backstop is ever used it will only be temporary and that the UK and EU will begin work immediately to replace the backstop with alternative arrangements by the end of December 2020.
Mrs May said: "What the decision today underlines is the importance of the House of Commons passing a Brexit deal next week so that we can bring an end to the uncertainty and leave in a smooth and orderly manner.
"Tomorrow morning I will be returning to the UK and working hard to build support for getting the deal through.
"I know MPs on all sides of the debate have passionate views and I respect those different positions.
"Last night I expressed my frustrations and I know that MPs are frustrated too - they have difficult jobs to do.
I hope we can all agree that we are now at the moment of decision and I will make every effort to make sure we can leave with a deal and move our country forward."