European leaders and British Prime Minister Theresa May agreed Wednesday to push the final deadline for the U.K. to depart the bloc until Halloween, with European Council President Donald Tusk warning British politicians to "not waste this time" without ratifying a formal withdrawal agreement.

Britain had been due to leave the EU on Friday, but May rushed to an emergency summit in Brussels to plead with her European counterparts to hold off on saying goodbye for a couple more months. The prime minister had asked for a delay only until June 30, but Tusk said in a tweet that she had agreed to a longer "flexible" extension, which provides for Britain to leave any time before Oct. 31 provided Parliament ratifies a divorce deal and passes accompanying legislation to ensure a smooth transition out of the EU.

At a news conference late Wednesday, May said she wanted to leave the EU "as soon as possible," and added that Brexit could still be accomplished before the end of June if lawmakers backed the withdrawal agreement she negotiated with EU leaders earlier this year.

"The timetable is clear," said May, who had said earlier in the day she hoped the deal could be ratified as soon as May 22, which would avoid the need for Britain to participate in elections for the European Parliament.

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 seen 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 French President Emmanuel 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 told reporters that he had agreed to the six-month extension "to preserve the unity" among the 27 member states and to give Britain "more time to deliver a deal." He added that it was "up to Britons to be clear with themselves and their people" in next month's European elections.

The withdrawal agreement already has been rejected three times by the House of Commons, forcing May to scramble to find common ground with the main opposition Labour Party. Labour has indicated it favored a softer Brexit than the government has proposed and wanted to retain a close economic relationship with the bloc. Those efforts had yet to achieve a breakthrough, though the two sides said they would resume discussions Thursday.

CLICK HERE TO GET THE FOX NEWS APP

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 triggering gridlock at British ports and possible shortages of goods.

May said last month that "as prime minister" she could not agree to let Britain stay in the EU beyond June 30. She also has promised to step down once Brexit is delivered. Many Conservative Party lawmakers have said they'd 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.

The Associated Press contributed to this report.