The European Union will call an emergency Brexit summit before Halloween, if negotiators miss a deadline of midnight tonight to agree a replacement for the Irish backstop.

EU leaders meet in Brussels on Thursday for what was to be the crunch Brexit meeting of heads of state and government. But they are prepared to hold another European Council to finalise a deal or agree an extension to the October 31 deadline, as the prospects of a no deal Brexit recede.

Boris Johnson is prepared to fly to the Belgian capital to get the deal “over the line” before Thursday’s meeting in Brussels and avoid a second summit, which sources said could be held on October 28 or 29.

The prime minister, who postponed a planned Cabinet meeting today, told French President Emmanuel Macron that Britain would “work hard” for a deal.

The EU has set a deadline of midnight tonight for Britain and the EU to agree a joint legal text on the replacement for the backstop.

Michel Barnier briefed EU-27 Europe ministers in Luxembourg on the last three days of intensive talks with Britain over an alternative to the Irish backstop on Tuesday. Talks ended at 11pm on Monday night before resuming this morning.

He said a deal was “still possible” this week but warned the agreement would be difficult and “more and more difficult to be frank”.

“Obviously any agreement must work for everyone, the whole of the UK and the whole of the EU. Let me add that it is also high time to turn good intentions into a legal text,” he added.

Mr Barnier told ministers at the meeting there were "three scenarios"; agreement tonight, an extension or "breakdown", sources said.

“There is some optimism, he is trying for a deal tonight,” said Jean Asselborn, Luxembourg’s foreign minister.

“Otherwise we will most probably need another summit later this month,” he added.

“There is a deadline to agree on a legal text, which is midnight by the latest,” a senior EU diplomat said.