European Union leaders have granted a request from British Prime Minister Theresa May to delay Brexit.
They have given the UK a two-tier extension.
After crunch talks at a summit in Brussels that ran late into Thursday night, the leaders formally announced that March 29th should be scrapped as the date Britain will leave the bloc.
They offered a delay until May 22nd, if Westminster MPs pass the Brexit deal by the end of next week.
But if the parliament rejects it again in meaningful vote three, the UK faces a new hard deadline of April 12th.
At that point it must "indicate a way forward" - including asking for a long Brexit delay and to take part in the EU Parliament elections - or fall out of the bloc with no deal.
Mrs May pressed her case for a delay to EU leaders earlier on Thursday evening, speaking to them for nearly 90 minutes - one of her longest addresses yet in such a forum.
She was not party to the talks where they made the final decision, which ended up running over four hours late.
EU Council President Donald Tusk declared a "unanimous agreement".
He explained: "As regards the extension, our decisions envisage two scenarios.
"In the first scenario, that is, if the withdrawal agreement is passed by the House of Commons next week, the European Council agrees to an extension until the 22nd of May.
"In the second scenario, that is, if the withdrawal agreement is not approved by the House of Commons next week, the European Council agrees to an extension until the 12th of April, while expecting the United Kingdom to indicate a way forward.
"What this means in practice is that, until that date, all options will remain open, and the cliff-edge date will be delayed."
"The UK government will still have a choice of a deal, no-deal, a long extension or revoking Article 50.
"The 12th of April is a key date in terms of the UK deciding whether to hold European Parliament elections.
"If it has not decided to do so by then, the option of a long extension will automatically become impossible."
The EU's chief Brexit negotiator, Michel Barnier, told reporters: "We have done our best - now the solution is in London".
Tánaiste Simon Coveney tweeted the outcome of the talks just before 11.00pm.
— Simon Coveney (@simoncoveney) March 21, 2019
European Commission President Jean-Claude Juncker and Mr Tusk shared a laugh as they were confronted by comments made last month about there being a "special place in hell" for people who campaigned for Brexit without a plan for how to carry it out.
The EU Council President joked: "According to our Pope, the hell is still empty. It means that there are a lot of spaces."
In a midnight news conference, Mrs May said the news "underlines" the "importance" of MPs backing the Brexit deal.
She softened her tone after facing a backlash 24 hours before for blaming parliament for the delay, acknowledging that "last night I expressed frustration but I know MPs are frustrated too".
Additional reporting: IRN