The European Court of Justice has ruled that the UK can unilaterally revoke its withdrawal from the EU.
The court found that if the UK does decide to revoke Article 50 and stop the Brexit process it would remain in the EU as a member state and the revocation must be decided following "democratic process".
In a statement, the ECJ said: "In today's judgment, the full court has ruled that, when a member state has notified the European Council of its intention to withdraw from the European Union, as the UK has done, that member state is free to revoke unilaterally that notification.
"That possibility exists for as long as a withdrawal agreement concluded between the EU and that member state has not entered into force or, if no such agreement has been concluded, for as long as 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."
It added: "The revocation must be decided following a democratic process in accordance with national constitutional requirements. This unequivocal and unconditional decision must be communicated in writing to the European Council."
The ECJ ruling comes ahead of Tuesday's meaningful vote on Prime Minister Theresa May's Brexit deal.
The court ruled, contrary to the UK Government's position, that the case is "relevant and not hypothetical".
However, the UK Government has said its policy is not to revoke Article 50.
The case was brought by a cross-party group of Scottish politicians, Labour MEPs Catherine Stihler and David Martin, SNP MP Joanna Cherry and MEP Alyn Smith, and Green MSPs Andy Wightman and Ross Greer, together with lawyer Jolyon Maugham QC, director of the Good Law Project.
They argued that unilateral revocation is possible and believe it could pave the way for an alternative option to Brexit, such as a People's Vote to enable remaining in the EU.
Lawyers representing the Council of the European Union and from the European Commission argued that revocation is possible but would require unanimous agreement from all member states.
The case was originally heard by the Court of Session in Edinburgh and two attempts by the UK Government to appeal against the referral to the European Court were rejected.
The case will be referred back to the Court of Session, where judges are expected to "frank" the decision and declare the European Court's answer to be the law on the matter.