Media playback is unsupported on your device Media caption Theresa May: "I hope we can all agree we are now at the moment of decision"

EU leaders have agreed on a plan to delay the Article 50 process, postponing Brexit beyond 29 March.

The UK will be offered a delay until 22 May, if MPs approve the withdrawal deal negotiated with the EU next week.

If they do not, the EU will back a shorter delay until 12 April, allowing the UK time to get the deal through or to "indicate a way forward".

Mrs May said there was now a "clear choice" facing UK MPs, who could vote for a third time on her deal next week.

They could back the withdrawal deal, deliver on the referendum and leave the EU in "an orderly manner" or face the prospect of having to stand candidates in the European Parliamentary elections, three years after the UK voted to leave the EU.

She said she would be "working hard to build support for getting the deal through". She said she had "expressed frustration" in her speech last night, in which she blamed MPs for the delay, but added "I know that MPs are frustrated too" and she was "very grateful" to those who had supported the deal.

"I will make every effort to make sure we can leave with a deal and move our country forward," she said.

She also dismissed calls to revoke Article 50 - as a petition calling for that on the Parliament website attracted more than two million signatures - saying people had voted to leave and were told their decision would be respected.

In a press conference with European Commission President Jean-Claude Juncker, European Council President Donald Tusk said that, until 12 April - by when the UK would have to indicate whether it would stand candidates in the 2019 European Parliament elections - "all options remain on the table ... the UK government will still have a chance of a deal, no deal, a long extension or revoking Article 50".

If the UK has not decided by 12 April whether to take part in the elections the "option of a long extension will automatically become impossible", he said.

He added that the atmosphere was "much better than I had expected" among EU leaders in discussions and he was now "much more optimistic".

Mr Juncker said the European Commission had "worked tirelessly" to negotiate the withdrawal deal and respond to requests from the UK for further reassurances about keeping the Northern Irish border open. Legally-binding assurances agreed in Strasbourg last week had been endorsed, he added.

"This closes and completes the full package. There is no more that we can have."

Discussions ran late into the evening on Thursday amid reports of disagreement between the 27 other EU leaders about the details.

They are understood to have discussed potential dates of 7 May or a longer delay until the end of the year.

Image copyright AFP Image caption What will EU leaders do if UK MPs reject the deal for a third time?

What's been agreed?

By Reality Check's Chris Morris

It's been clear for some time that EU leaders were prepared to offer a short extension of the Article 50 process.

But there have been different views about how long "short" should be.

Now we know.

If the UK doesn't take part in European elections, a strict interpretation of the law rules out an extension until the end of June, which is what the Prime Minister had initially requested.

That's why the 27 EU leaders offered a possible extension until 22 May, the day before voting in the elections begins.

Such an extension is only on offer, though, if UK MPs vote for the Brexit deal in the House of Commons next week. And EU leaders know the numbers there don't look good for the government.

So their second offer is a much shorter extension until 12 April, by which time the UK would have to legislate for holding elections in May.

The government has insisted that it has no intention of taking part in the elections.

But the language used by the EU keeps the possibility of UK participation open. That means that a much longer extension has not been ruled out, even though that too is an idea that has been rejected by Theresa May in the past.

So the legal and political calculations that surround the EU's offer are complex, and the outcome is difficult to predict.

But one thing is clear - barring dramatic developments, it confirms that the UK will not be leaving the EU on 29 March as originally intended.