– Worn down by three years of indecision in London, European Union leaders on Thursday grudgingly offered the U.K. more time to ease itself out of the bloc, delaying by several weeks — but not eliminating — the threat of a chaotic British exit.

After a meeting that stretched through the afternoon and over dinner, the bloc said Britain could postpone its March 29 departure to May 22 — if the U.K. Parliament approves Prime Minister Theresa May's divorce deal next week.

If the twice-rejected deal is thrown out again, the bloc says Britain has until April 12 to "indicate a way forward."

"Now it is finally up to the British political system," French President Emmanuel Macron said, adding that any final decision must come ahead of the May 23-26 European Parliament election.

May — who has spent almost three years telling Britons they will leave the E.U. on March 29, 2019 — put a positive spin on the delay.

She said the E.U. decision underlines "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."

The late-night offer eased some of the deep uncertainty among leaders at an E.U. summit in Brussels, which was exceeded only by the high anxiety being felt by politicians, businesses and citizens in Britain. The British military has even set up a command post in a bunker under the defense ministry in London to help coordinate "no-deal" planning.

The House of Commons is split, both among and within its political parties, over whether and how to leave the E.U. It has twice rejected the deal May brokered with the bloc's leaders late last year.

This week, May finally acknowledged the Brexit gridlock and asked the E.U. to delay Britain's departure until June 30, to create time to win parliamentary approval for her deal in a third attempt and then pass the legislation necessary for a smooth departure.

But opposition to May's agreement among British politicians appeared to be hardening, rather than softening, after she blamed Parliament for the Brexit impasse.

In a televised address Wednesday night, May accused lawmakers of "infighting," "political games" and "arcane procedural rows," but acknowledged no personal error in creating the deadlock.

A lawmaker from May's Conservative Party called the speech "toxic." Legislator Anna Soubry of the breakaway Independent Group described it as the "most dishonest and divisive statement from any prime minister."

May struck a conciliatory note at a late-night Brussels news conference, saying "I know MPs on all sides of the debate have passionate views, and I respect those different positions."

"Last night I expressed my frustration. I know that MPs are frustrated too. They have difficult jobs to do," she added.

But May also refused to change course, calling on lawmakers to back her agreement and refusing to rule out a no-deal exit if they did not back her.

May said that if the deal falls, by April 12, "we would either leave with no deal, or put forward an alternative plan" that involved participating in E.U. Parliament elections.

"I believe strongly that it would be wrong to ask people in the U.K. to participate in these elections three years after voting to leave the E.U.," she said.

Businesses and economists say a no-deal Brexit would cause huge disruptions and billions in costs to the economies of both Britain and the E.U.

Britain's military said the command post under the ministry of defense was set up as a continuation of earlier planning operations, called Operation Redfold, designed to minimize disruption in the event of a no-deal Brexit.

The ministry said it had 3,500 troops on standby to help with any disruptions if the government asks for assistance.