The vote on Tuesday night is the “meaningful vote” promised by Theresa May early on in the Brexit negotiations. The deal she has agreed with the rest of the EU has to be approved by the UK parliament before it comes into force.

The vote will be on a government motion that says “this House approves … the negotiated withdrawal agreement”. If a majority of MPs vote for it, the UK will be ready to leave the EU on 29 March and enter a transition period to the end of 2020, during which we will for most purposes continue to be treated as an EU member state.

There are some bills that still need to be passed to put the deal into law, but if MPs back the government motion on Tuesday, they should also vote for them.

However, as things stand the government has no prospect of winning the vote. It is opposed by all the opposition parties, including the DUP, despite its deal with the Conservatives that has kept May’s minority government in office so far. It is also opposed by about 100 Tory MPs, although how many of them will in the end vote against the government is anybody’s guess.

They oppose the deal for different reasons. Jeremy Corbyn says Labour wants a closer relationship with the EU economy, in particular a permanent customs union rather than a temporary one. Labour is happy to let the EU negotiate trade deals on the UK’s behalf, and claims the EU would give us a say in such talks.

But the big problem with the deal is the so-called backstop. This is a legally binding protocol to the withdrawal agreement that sets out the rules for keeping an open border between Northern Ireland and the Irish Republic.

Many Conservative MPs don’t like it because it would apply in perpetuity after the end of the transition period unless it is replaced by a trade deal between the EU and the UK that would also keep the Irish border open. The UK would not be allowed to refuse to apply the terms of the backstop, unless the EU agrees that other arrangements to keep the border open are in place.

Although everyone says they want to avoid checks and controls at or near the Irish border, Tory MPs object in principle to being bound by an international treaty which the UK cannot terminate. Corbyn has also said that, under a Labour deal, “There certainly wouldn’t be a backstop from which you can’t escape.”

In addition, the DUP objects to the backstop because it would require extra checks on goods arriving in Northern Ireland from the rest of the UK to make sure that they meet EU single market standards. They call this a “regulatory border down the Irish Sea” and say May promised it would never happen.

However, the prime minister has repeatedly said that the backstop cannot be changed. She spent most of this year trying to get the EU to put a time limit on its operation; in the end she decided she could live with it, arguing that the EU has an incentive to end it because it would allow the UK and especially Northern Ireland to “cherry pick” the benefits of the single market.

Her rebel MPs still believe that the EU would blink at the last moment if faced with the prospect of a no-deal Brexit – and Labour insist their deal would not need the backstop anyway (it would).

Meanwhile, pro-EU MPs may be more determined to vote against the deal if the European Court of Justice rules on Monday, as expected, that the UK is entitled to cancel Brexit without needing the permission of other EU members.

So May is heading for defeat on Tuesday. That would not be the end of the matter. There is nothing in the UK’s flexible constitution to stop her coming back to parliament later and asking it to vote again – and the real deadline to allow for European Parliament approval in time for a 29 March exit is in mid-January.

But, because she seems likely to lose so badly, there is speculation that she might postpone the vote, although that decision could be made at the last moment, because first there will be votes on amendments to the government motion.

One amendment, tabled by Hilary Benn, the Labour chair of the Brexit select committee, opposes both May’s deal and leaving the EU without a deal. Because most Tory Eurosceptic MPs think a no-deal Brexit is a “real” Brexit, they won’t vote for it.

But if enough “soft Brexit” Tory MPs do, it could pass by a narrow margin. That means the government would avoid a heavy defeat, as its original motion would no longer exist, having been amended. For that reason, Corbyn may instruct his MPs to abstain, allow the amendment to be defeated, and then to vote against the government on the original motion.

More procedural wrangles are possible, and we may not know until late on Tuesday night quite how bad things look for the prime minister.

The Independent.