The European Court of Justice has ruled that the UK can cancel its Article 50 notification and unilaterally end the process of withdrawing from the bloc, a move that could leave the door open for the British government to theoretically cancel its planned Brexti departure scheduled for March 2019 without the consent of the 27 EU members.

The ECJ ruling comes just a day before a crucial vote in parliament of the EU-UK draft Withdrawal Agreement. That agreement was negotiated by Prime Minister Theresa May but does not have enough support in the parliament to pass. If, however, the British parliament votes in favour and ratifies the Withdrawal Agreement, the UK will no longer be able to withdraw.

Unilateral cancellation is possible if the withdrawal agreement has not entered into force or if an agreement has yet to be concluded and if the two-year period from the date of the notification of the intention to withdraw from the EU, and any possible extension, has not expired.

The UK’s pro-Remain opposition has championed thecase that the UK can unilaterally withdraw its Article 50 application ever since the controversial referendum over Brexit was first held in June 2016, a view that both pro-Brexit supporters and an angered Brussels establishment have repeatedly refused to endorse.

The ECJ’s statement makes clear that a unilateral withdrawal cannot be an executive decision of the British government, but must also be approved by parliament. The UK must then notify Brussels of its decision to “unequivocally and unconditionally” follow through with a full withdrawal.

The UK would still be able to retain its membership on the same terms, which includes a series of opt-outs secured by the UK since it joined the EU.

The case was brought to ECJ by a cross-party group of politicians from the pro-Remain Scottish National Party and Labour parties after the UK government unsuccessfully tried to appeal against a referral to the ECJ on two separate occasions.

The ruling was anticipated, as last week the ECJ’s advocate general Manuel Campos Sanchez-Bordona, issued an opinion – that was not binding for the Court – making today’s ruling predictable.