The UK can unilaterally revoke its withdrawal from the EU, the European Court of Justice has ruled.
A spokeswoman for the court 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."
The spokeswoman continued: "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."
Monday's ruling upheld a finding by ECJ advocate general Manuel Campos Sanchez-Bordona, who said last week that Article 50 of the Lisbon Treaty allows the "unilateral revocation of the notification of the intention to withdraw from the EU, until such time as the Withdrawal Agreement is formally concluded".
He rejected the contention that the mechanism for a member state to quit the trade bloc could only be reversed following a unanimous decision of the European Council.
It comes the day before Theresa May is due to attempt to get her Brexit Withdrawal Agreement through Parliament.
In Monday's ruling the judges ruled that a country's decision to revoke Article 50 after notifying the EU of its decision to withdraw "reflects a sovereign decision to retain its status as a Member State of the European Union, a status which is neither suspended nor altered by that notification", the spokeswoman added.
Lib Dem Brexit spokesman Tom Brake said: "The ECJ has made clear that the UK can stop Brexit unilaterally. The Government can therefore prevent a chaotic no-deal.
"For the sake of people's livelihoods, the Prime Minister must end the uncertainty and rule out a no-deal.
"It is clear any Brexit will make people poorer and reduce the UK's standing in the world.
"MPs should not only vote down Theresa May's deal, but back a People's Vote with the option to remain in the EU."
SNP MEP Alyn Smith, one of a cross-party group of Scottish politicians who brought the case, said it was "dynamite".
He said: "Bringing the case was a risk but it has worked better than we could have hoped for.
"Our case has confirmed, once and for all and from the highest court in the business, that the UK can indeed change its mind on Brexit and revoke Article 50, unilaterally.
"The timing is sublime. As colleagues in the House of Commons consider Mrs May's disastrous deal we now have a roadmap out of this Brexit shambles.
"A bright light has switched on above an 'EXIT' sign."
Environment Secretary Michael Gove said the ruling does not alter the Government's intention to leave the EU in March 2019.
He 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."
Scotland's Constitutional Relations Secretary, Mike Russell, said: "This is a hugely important decision that provides clarity at an essential point in the UK's decision-making over its future relationship with the EU.
"People in Scotland overwhelmingly voted to remain in the EU and that continues to be the best option for Scotland and the UK as a whole.
"This judgment exposes as false the idea that the only choice is between a bad deal negotiated by the UK Government or the disaster of no deal.
"We now know, thanks to the efforts of Scotland's parliamentarians, that remaining in the EU is still on the table."
First Minister Nicola Sturgeon tweeted: "Important judgment from ECJ - Article 50 can be unilaterally revoked by UK."
She added: "So an extension of Article 50 to allow time for another vote, followed by revocation of Article 50 if the outcome is Remain seems to be an option that is now open to the House of Commons."
Catherine Stihler, a Scottish Labour MEP and co-litigant, said: "This historic ruling paves the way for the disastrous Brexit process to be brought to a halt.
"We now know, beyond any doubt, that Westminster can revoke its withdrawal from the European Union.
"This has been a lengthy and expensive legal process, but the result proves that it was worthwhile.
"When MPs vote on Theresa May's Brexit deal, they now know they can ultimately choose to stop Brexit and keep the best deal we currently have as a full member of the EU.
"I am increasingly confident that is what will happen if MPs agree to a People's Vote, which is what the country now urgently needs."