The summit deal struck in Brussels in the early hours of Thursday means Britain will remain a member state of the EU until 31 October but with the option to leave earlier if British Prime Minister Theresa May can secure parliamentary support for her Brexit deal.
The extension is longer than May had sought but less than many in the bloc wanted.
“This extension is as flexible as I expected and a little bit shorter than I expected but it is still enough to find the best possible solution”, the European council president, Donald Tusk, told a media conference. In reference to the extra six months of EU membership he said: “Please do not waste this time”.
He suggested May's government now had time to ratify the deal agreed with EU leaders in November, to rethink its approach or to stop the Brexit process altogether.
The summit conclusions say Britain must hold European elections set for 23 May or if "the United Kingdom fails to live up to this obligation, the withdrawal will take place on 1 June 2019".
Prime Minister Theresa May said she would now keep working to get her withdrawal agreement approved by parliament to ensure an orderly split, saying her goal was to leave "as soon as possible".
She will address the House of Commons on Thursday before her officials meet for further talks with the main opposition Labour party, to try to find a way through the political deadlock.
‘Best possible compromise’
The EU is also to hold a symbolic summit on 20 and 21 June to review the UK’s behaviour as a member state.
This followed an outspoken intervention by French president Emmanuel Macron, about the need to avoid a “rogue” Britain undermining the European project.
Macron had pushed for a much shorter extension, insisting that letting Britain stay in the Union beyond the 30 June deadline sought by Theresa May risked undermining the project of European integration - one of his main policy goals.
But most leaders, notably German Chancellor Angela Merkel, backed the longer plan to avoid a chaotic no-deal departure.
After the new date was announced Macron said leaders had found the "best possible compromise", because 31 October preserved EU unity, allowed the British more time and preserved “the good functioning of the European Union”.