British PM May accepts EU leaders’ offer at an emergency meeting in Brussels on Wednesday.

Leaders of the 27 countries remaining in the European Union and British Prime Minister Theresa May have agreed to extend Brexit until October 31.

At an emergency meeting in Brussels that went on for more than six hours on Wednesday, the EU leaders agreed to offer May a six-month extension that was accepted by the British prime minister.

“EU27/UK have agreed a flexible extension until 31 October. This means additional six months for the UK to find the best possible solution,” European Council President Donald Tusk’s text read.

EU27/UK have agreed a flexible extension until 31 October. This means additional six months for the UK to find the best possible solution. — Charles Michel (@eucopresident) April 10, 2019

May had asked to postpone Britain’s departure from the EU until June 30.

Most EU leaders favoured a longer term, until year-end or later, according to EU sources.

But French President Emmanuel Macron said he took responsibility for blocking a long delay and convincing other leaders to agree to a shorter one in order to preserve the functioning of the EU.

“It’s true that the majority was more in favour of a very long extension. But it was not logical in my view, and above all, it was neither good for us, nor for the UK,” said Macron.

The extension is flexible, EU diplomats say, meaning Britain can leave once its Brexit divorce deal is ratified. However, if it stays beyond May 22, the country will likely be required to participate in EU elections.

“Please don’t waste this time,” Tusk told a news conference after eight hours of EU leaders’ talks on the matter.

He said Britain still had all the options on Brexit available during the extension, from approving the stalled divorce deal, to changing its leave strategy to cancelling the departure altogether.

British lawmakers have rejected May’s divorce deal three times, and attempts to forge a compromise with her political opponents have yet to bear fruit.

Following the agreement in Brussels, May acknowledged there was “huge frustration” that she had to request a second delay to Brexit, urging parliament to finally support her Brexit deal.

“I know that there is huge frustration from many people that I had to request this extension. The UK should have left the EU by now and I sincerely regret the fact that I have not yet been able to persuade parliament to approve the deal,” she told a news conference.

“But the choices we now face are stark and the timetable is clear. So we must now press on at pace with our efforts to reach consensus on a deal that is in the national interest,” she said, adding that she would not pretend that the next few weeks “will be easy or there is a simple way to break the deadlock in parliament”.