Theresa May, Prime Minister of the United Kingdom talks to the journalists in the Europa Building during the European Council Summit in Brussels, Belgium on December 13, 2018.

European Union leaders and the U.K. government have agreed to a "flexible extension" of the Brexit deadline until Oct. 31.

Donald Tusk, president of the European Council, said this development provides an "additional six months for the UK to find the best possible solution."

@eucopresident: EU27/UK have agreed a flexible extension until 31 October. This means additional six months for the UK to find the best possible solution.

The emergency summit was convened after Prime Minister Theresa May requested a further delay to the U.K.'s departure from the bloc.

She was forced to ask for more time after U.K. lawmakers rejected the Brexit deal she struck with the EU last year in three parliamentary votes on the agreement. Members of Parliament (MPs) have also failed to reach a majority in support of alternative options, however.

May has been holding talks with opposition Labour leader Jeremy Corbyn in the hope that a compromise or alternative plan can be found, but this has so far proved elusive.

After two years of Brexit negotiations, the U.K. was meant to leave the EU on March 29. With Parliament not backing the deal on offer, the government asked for a short delay to April 12 in order to get backing for an alternative Brexit strategy.

As that has failed to materialize, May was forced last week to ask for a longer delay to June 30 in order to prevent the U.K. leaving the bloc without a deal.

The EU had already warned that a longer delay would mean that it has to take part in European Parliament elections in late May. The U.K. would have to take part in those elections and vote on representatives to the European Parliament. Those members would stop working for the EU on the day the U.K. leaves the bloc.

A source familiar with the negotiations told CNBC that France was the toughest to convince. Diplomatic sources told Reuters that French President Emmanuel Macron said a delay beyond June 30 would undermine the bloc. Some diplomats expressed frustration with his stance, suggesting that Paris was adding more uncertainty to the summit.

WATCH: Niall Ferguson: Brexit has turned into a student asking for a paper extension