European Union leaders on Thursday offered Britain an extension to Brexit that would allow the country 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, two officials said.
The officials spoke to The Associated Press on condition of anonymity to discuss the closed-door negotiations. European Council President Donald Tusk confirmed in a tweet that an extension had been agreed to, but he did not disclose the date.
Tusk was meeting May, who had sought a delay only until June 30, to see if she would agree to the offer.
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.
"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 believes that a June 30 deadline is 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.
Macron is concerned that letting Britain stay too long would distract the EU from other issues — notably next month's European Parliament elections.
"The no-deal situation is a real option," said the official, who was not authorized to be publicly named according to presidential policy. "Putting in danger the functioning of Europe is not preferable to a no-deal."
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.
If no extension materializes Wednesday, Britain will leave the bloc Friday with no deal, unless it cancels Brexit independently.
Economists and business leaders warn 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.
"I don't anticipate that the U.K. will leave this Friday," Irish Prime Minister Leo Varadkar said. "I'm very confident that there will be an extension agreed today. What's still open is how long that extension will be and what the conditions will be."
But the bloc's patience is wearing thin.
Several leaders also said they would require assurances of good behavior in return for another delay.
Dutch Prime Minister Mark Rutte said the EU leaders' decision would hinge on "what her plan is now to get that withdrawal agreement through Parliament, and how we can get guarantees that in the meantime the United Kingdom will stay as a loyal partner."
The British government insists it won't be obstructive, since it wants to keep close ties to the bloc. But pro-Brexit British politicians have said Britain should be disruptive. Conservative lawmaker Mark Francois said that if the U.K. remained in the bloc, "then in return we will become a Trojan Horse within the EU."
May's future is uncertain, whatever the EU decides.
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.
Ireland's Varadkar, whose country shares a border with the U.K. and would be among the hardest hit by a no-deal Brexit, said Britain was in "a difficult position."
"It doesn't want to leave without a deal; at the moment it doesn't want to vote for the deal. And of course a lot of people, maybe even half the population, don't want to leave at all," he said.
Associated Press writers Mike Corder and Angela Charlton in Brussels, Danica Kirka in London and Sylvie Corbet in Paris contributed to this report.