BRUSSELS (AP) — European Union leaders and Britain on Thursday agreed to a Brexit extension that will allow the U.K. to delay its EU departure date until Halloween.
Leaders of the 27 remaining EU member states met for more than six hours before agreeing after midnight to postpone Brexit until Oct. 31.
European Council President Donald Tusk presented the offer to May, who had asked for a delay only until June 30.
Tusk said in a tweet that the British leader had agreed to the longer "flexible" extension, which means Britain can leave before October if it ratifies a withdrawal deal with the EU.
"This means additional six months for the UK to find the best possible solution," Tusk wrote.
Just two days before Britain was due to leave the EU, its leaders spent a long dinner meeting wrangling over whether to save Britain from a precipitous and potentially calamitous Brexit, or to give the foot-dragging departing nation a shove over the edge.
May pleaded with them at an emergency summit to delay Britain's exit, due on Friday, for a couple more months while the U.K. sorts out the mess that Brexit has become.
Some were sympathetic, but French President Emmanuel Macron struck a warning note shortly before the European leaders met.
"Nothing is decided," Macron said as he arrived at the summit, insisting on "clarity" from May about what Britain wants.
"What's indispensable is that nothing should compromise the European project in the months to come," he said.
May said a June 30 deadline was enough time for Britain's Parliament to ratify a Brexit deal and pass the legislation needed for a smooth Brexit.
But British lawmakers have rejected her divorce deal three times, and attempts to forge a compromise with her political opponents have yet to bear fruit.
May spoke to the 27 EU leaders for just over an hour, before they met for dinner without her to decide Britain's fate. In contrast to some testy recent summits, there were signs of warmth and even humor. May and German Chancellor Angela Merkel were filmed laughing over a tablet bearing an image showing the two of them speaking to their respective Parliaments on Wednesday wearing similar blue jackets.
Many leaders said they were inclined to grant a Brexit delay, though Macron had reservations after hearing May speak. An official in the French president's office said the British leader hadn't offered "sufficient guarantees" to justify a long extension.
Others suggested a longer delay would likely be needed, given the depth of Britain's political disarray.
May signaled she would accept a longer extension, as long as it contained a get-out-early cause should Britain end its Brexit impasse.
"What is important is that any extension enables us to leave at the point at which we ratify the withdrawal agreement," May said as she arrived in Brussels.
She added that she was hopeful it could be as soon as May 22 — a key date since that would avoid the need for Britain to participate in elections for the European Parliament.
Several months have passed since May and the EU struck a deal laying out the terms of Britain's departure and the outline of future relations. All that was needed was ratification by the British and European Parliaments.
But U.K. lawmakers rejected it — three times. As Britain's departure date of March 29 approached with no resolution in sight, the EU gave Britain until Friday to approve a withdrawal plan, change course and seek a further delay to Brexit, or crash out of the EU with no deal to cushion the shock.
Economists and business leaders have warned that a no-deal Brexit would lead to huge disruptions in trade and travel, with tariffs and customs checks causing gridlock at British ports and possible shortages of goods.
A disorderly Brexit would hurt EU nations, as well as Britain, and all want to avoid it.
May's future, meanwhile, is uncertain.
She has previously said that "as prime minister" she could not agree to let Britain stay in the EU beyond June 30, and she has also promised to step down once Brexit is delivered. Many Conservative Party lawmakers would like her to quit now and let a new leader take charge of the next stage of Brexit. But they can't force her out until the end of the year, after she survived a no-confidence vote in December.
Every British initiative to get a deal has floundered so far. Several days of talks between May's Conservative government and the main opposition Labour Party aimed at finding a compromise have failed to produce a breakthrough. Labour favors a softer Brexit than the government has proposed, and wants to retain a close economic relationship with the bloc. The two sides said they would resume their discussions Thursday.