The European Union agrees to delay Brexit until May 22 if Members of Parliament back Theresa May's deal next week.

However, even if MPs reject the deal for a third time, the UK will have an extra two weeks to seek an alternative plan or agree to a longer delay.

If MPs don't vote for May's deal, the extension will run until April 12, EU leaders agreed on Thursday.

Any longer delay would be conditional on the UK taking part in the European Parliament elections in May.

LONDON — The European Union will let the United Kingdom have a two-month delay to Brexit if members of the UK Parliament vote for Theresa May's deal next week.

For the past two years, the UK has been due to leave the EU in on March 29 — but on Thursday, leaders of the 27 other EU member states agreed to extend the Article 50 withdrawal process to May 22 if MPs vote for the Prime Minister May's deal. If they do not, then there will be a shorter, two week delay, to April 12.

The decision means that the UK is no longer hurtling towards a no-deal scenario on March 29 after failing to decide on an exit plan — but the cliff-edge will be moved to April 12 unless MPs can agree otherwise.

The May date coincides with the start of the European Parliament elections. However, both offers from the EU fall some way short of the three-month extension ending on June 30 that Prime Minister May had asked for.

There was reportedly disagreement among EU member states about the length of the extension, causing the meeting in Brussels to overun, lasting late into the evening.

EU leaders expressed their frustration with the UK's failure to resolve the crisis and were reportedly unimpressed by May's answers to their questions about what she intends to do next.

"The European Council agrees to an extension until the 12th of April, while expecting the United Kingdom to indicate a way forward," European Commission president Donald Tusk said on Thursday night.

"What this means in practice is that, until that date, all options will remain open, and the cliff-edge date will be delayed. The U.K. government will still have a choice of a deal, no-deal, a long extension or revoking Article 50."

President of the European Commission Jean-Claude Juncker (L) and European Council President Donald Tusk (R) speak during a press conference after the end of the first day of the European Summit on March 21 2019, in Brussels. ARIS OIKONOMOU/AFP/Getty Images

Speaking after the decision, May attempted to reach out to UK MPs who were enraged by her speech in Downing Street on Wednesday, in which she blamed them for the failure to pass a deal.

The statement on Wednesday, which her own chief whip has reportedly described to Conservative MPs as "appalling" has killed off what little chance May had of passing her deal next week.

"I expressed my frustrations, and I know that MPs are frustrated too — they have difficult jobs to do," May said at a late night press conference in Brussels

"There are passionately held views on all sides. I am very grateful to those MPs who have supported the deal, to those who have come around to support the deal; and to all those MPs I have been meeting across the house."

The EU remains pessimistic about the prospects of May's deal winning the support of the UK Parliament. One EU source told Business Insider: "[There is] no expectation here that the deal will pass after May's speech last night."

Senior figures have suggested that Brexit could be delayed for a much longer period of time if the UK can illustrate a clear purpose for doing so — possible options include a softer Brexit, or even a new referendum.

MPs will attempt to take control of the Brexit process next week to avert no deal and push for a softer Brexit.

A Brexit amendment set to be brought forward by Conservative MP Oliver Letwin on Monday could force the government to hand over control of parliamentary business next week.

MPs who back the amendment — including a number of ministers — intend for it to lead to a series of "indicative votes" on possible alternatives to the Brexit deal which is currently on the table.

French President Emmanuel Macron warned UK MPs that voting down May's deal next week would "guide everybody" to a no-deal scenario, which is opposed by the UK government, the EU, and the vast majority of MPs in London.