Boris Johnson has three days in which to persuade the European council to sign off a new draft withdrawal agreement and pass the same document through parliament, if the UK is to pass a Brexit deal and leave the EU by 31 October – a Herculean task that could end in failure.

Juncker: UK will leave EU on 31 October if MPs back Brexit deal Read more

Here is a run down of events, and some of the obstacles the prime minister must overcome, if that is to happen.

What is happening now?

Johnson flew to Brussels on Thursday, with a proposed deal that contains a revised protocol on Ireland and Northern Ireland, and a new political declaration on the future EU-UK relationship.

The proposed deal has so far received cautious support from key EU figures including the chief negotiator, Michel Barnier, the European commission president, Jean-Claude Juncker, and the European council president, Donald Tusk.

The PM is also meeting other key EU leaders, including the German chancellor, Angela Merkel.

Play Video A Brexit deal has been reached, says Michel Barnier – video

Does this mean the UK will leave on 31 October?

For that to happen, the EU council, which meets on Thursday, should authorise the signature of the withdrawal agreement, before sending it to the European parliament for its consent. This is expected to be a formality.

Johnson is likely to face difficulties once he returns to Westminster on Friday, ahead of a highly unusual Saturday sitting of the House of Commons, when he will attempt to persuade MPs to pass his deal in what would be a fourth meaningful vote on a Brexit deal.

If all that goes to plan – and it is a very big if – the UK will leave the EU on Halloween.

What has been agreed between the EU and the UK?

The new proposal avoids a hard border across the island of Ireland; Northern Ireland would remain aligned to a limited set of single market rules and remain part of the UK’s customs territory.

The Northern Ireland assembly would have a voice on the long-term application of relevant EU law in Northern Ireland. Crucially, this would mean the deal would only have to achieve majority support from assembly members, not a “double lock” from representatives from both communities, as demanded by the DUP.

What has happened with the DUP?

The Northern Ireland party’s position is important if the government is to pass the deal. Not only does it carry 10 votes, it also wields influence over some hardline Tory Brexiters and Johnson is far short of a majority in the Commons.

The DUP released a statement on Thursday morning saying it could not support Johnson’s proposals because of what had been “suggested on customs and consent issues”. The party added there was “a lack of clarity on VAT”.

Quick guide Why is the Irish border a stumbling block for Brexit? Show Hide Counties and customs Inside the EU, both Ireland and Northern Ireland are part of the single market and customs union so share the same regulations and standards, allowing a soft or invisible border between the two.

Britain’s exit from the EU – taking Northern Ireland with it – risks a return to a hard or policed border. The only way to avoid this post-Brexit is for regulations on both sides to remain more or less the same in key areas including food, animal welfare, medicines and product safety. The 'backstop' in Theresa May's Withdrawal Agreement was intended to address this - stating that if no future trade agreement could be reached between the EU and the UK, then rules and regulations would stay as they are. This has been rejected by Brexit supporters as a 'trap' to keep the UK in the EU's customs union, which would prevent the UK striking its own independent trade deals. There are an estimated 72m road vehicle crossings a year between Northern Ireland and the Republic of Ireland, and about 14% of those crossings are consignments of goods, some of which may cross the border several times before they reach a consumer. Brexit supporters say this can be managed by doing checks on goods away from the border, but critics say it will be difficult to police this without any physical infrastructure like border posts or cameras, which could raise tensions in the divided communities of Ireland.

Interactive: A typical hour in the life of the Irish border Photograph: Design Pics Inc/Design Pics RF

Does the confidence and supply deal with the DUP still stand?

The agreement between the Tories and the DUP, which has propped up the government since Theresa May’s 2017 general election, has not yet been commented upon by the DUP. Government sources have pointed out that the DUP continued to support May’s government after voting against her Brexit deal.

What does Johnson need to do now?

The prime minister’s biggest hurdle will be passing the proposed deal through parliament. There has been movement in the Commons since March – the last time a deal was brought before MPs.

Can Johnson pass his Brexit deal through the House of Commons? Read more

The most significant of these was the expulsion of 21 Conservative rebels from the party after they voted against the government. Johnson now rules with a minority, with 43 fewer voting members than the opposition.

He has a deficit of 58 votes to overcome from when May’s withdrawal agreement was defeated for a third time. It is unlikely that he would lose many of the 286 MPs who voted for a deal last time around, leaving him with the task of winning at least 30 extra MPs over to his cause.

For this, he could turn to the European Research Group and the “Spartans” – about 80 Eurosceptic Tories who opposed May’s deal; the 21 expelled Tories who may be persuaded to back a deal to stop a no-deal Brexit; and Labour rebels, 19 of whom signed a letter to the EU asking them to agree a deal with Johnson so they could vote for it.

DUP sources delivered a blow to the prime minister on Thursday night when they said they would vote against his deal rather than abstain.

If he fails, will the PM apply for an extension or will the UK crash out?

The Brexit secretary, Steve Barclay, indicated the UK will ask for an extension on Wednesday, when he said the government would stay within the law and carry out the will of parliament as outlined in the Benn act.

However, some No 10 sources have claimed Johnson could send a second letter, withdrawing the first, allowing the UK to leave without a deal. Barclay told MPs he knew of no such plan.

Even if the prime minister requests an extension there is no guarantee the EU27 would agree.