The European Court of Justice (ECJ) 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 crunch 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.
Mr Wightman hailed the "momentous" ruling, saying: "It is now clear that the UK can, if it chooses, change its mind and revert to our current EU membership arrangements.
"MPs now know that stopping Brexit altogether is an option open to them before the end of the Article 50 period.
"Parliament can now back a People's Vote in the knowledge that a Remain outcome could be acted on unilaterally, should that be what people decide."
Environment Secretary Michael Gove told BBC Radio 4's Today programme: "We voted very clearly - 17.4 million people sent a clear message that we wanted to leave the European Union and that means also leaving the jurisdiction of the European Court of Justice.
"So, this case is all very well but it doesn't alter either the referendum vote or the clear intention of the Government to make sure that we leave on March 29."