European Council President Donald Tusk, left looks on as Britain's Prime minister Theresa May, center left, and Germany's Chancellor Angela Merkel, right, look at a tablet ahead of a pre-dinner meeting during an EU summit at the Europa building in Brussels. Picture: Kenzo Tribouillard, Pool Photo via AP

Brussels - British Prime Minister Theresa May and EU leaders agreed early Thursday to a Brexit extension until October 31 at the latest, narrowly averting a no-deal Brexit the following day.

However, within minutes of finalizing their decision at a special EU summit in Brussels, European Council President Donald Tusk hinted that there could be further reprieves down the road.

"Our intention is to finalize the whole process in October," Tusk said. "But I am too old to exclude another scenario. [...] Everything is possible."

The flexible extension - which would allow Britain to leave the EU whenever its withdrawal deal is approved - grants Britain a further six months "to find the best possible solution," Tusk wrote on Twitter.

May needs the extra time to broker parliamentary approval on the withdrawal deal negotiated with Brussels, which lawmakers in the House of Commons have rejected three times.

The embattled British premier had asked for a delay until June 30, but most EU leaders favoured a longer term, according to EU sources. The deadline has already been postponed once, from March 29.

However, French President Emmanuel Macron dug in his heels during the eight-hour summit, insisting on a shorter extension so Brexit does not threaten the functioning of the EU.

EU leaders set several conditions, notably requiring Britain to participate in European Parliament elections if it is still a member when they begin on May 23. Otherwise "the withdrawal will take place on 1 June 2019," the 27 leaders wrote in a joint statement.

However, May expressed hope that Britain would be out by then.

"If we are able to pass a deal in the first three weeks of May, we will not have to take part in European elections and will officially leave the EU on Saturday June 1," she told journalists in Brussels.

EU leaders insisted in their statement that during the extension, the withdrawal deal cannot be reopened. Britain is expected to act in a "constructive and responsible" manner until its departure, refraining from measures that could "jeopardize" EU objectives.

They agreed to "take stock" of the situation at their regular June summit, however this date "is not a cliff-edge," Tusk insisted.

Macron justified the October 31 deadline by explaining that Britain would have left before the new European Commission takes up its work the following day, thus preventing London from hampering EU priorities.

Across the Atlantic, US President Donald Trump has complained the EU has been "so tough" on Britain.

"Too bad that the European Union is being so tough on the United Kingdom and Brexit," Trump wrote on Twitter.

The US president also accused the EU of being "a brutal trading partner with the United States, which will change."

He added: "Sometimes in life you have to let people breathe before it all comes back to bite you!"

May has conceded that the weeks ahead would not be easy, noting that Britain faces "stark" choices.

While rejecting the withdrawal deal, parliament has also failed to coalesce around any other option, prompting May's Conservative government to hold talks with the opposition Labour Party in a bid to break the impasse.

These negotiations - a rarity in British politics - are set to continue Thursday.

Labour's key demand is that Britain remains in a long-term customs union with the EU, but this is anathema to many Conservative eurosceptics.

Should the October deadline prove too tight, German Chancellor Angela Merkel suggested that the EU could grant yet more time if it means the withdrawal deal is adopted.

"In our view, it doesn't depend on the exact day," she said.

dpa