The Luxembourg-based ECJ said that given the absence of any exit provision in Article 50, countries are able to change their mind in line with their own constitutional arrangements and that such a move “reflects a sovereign decision.”

The British government is free to do so as long as no withdrawal agreement has entered force.

A member state can also choose to change its mind in the case where no agreement has been reached, as long as the two-year time limit, including any transition period, has not expired.

“People in Scotland overwhelmingly voted to remain in the EU,” he said. “This judgment exposes as false the idea that the only choice is between a bad deal negotiated by the U.K. government or the disaster of no deal.”

British Prime Minister Theresa May has repeatedly said the government will not seek to delay or reverse Brexit.

But the court’s opinion is another headache for the Conservative prime minister as she battles to win Parliament’s backing through a crucial vote scheduled for Tuesday for the divorce deal she has agreed with the EU.

British Environment Secretary Michael Gove, who helped drive the Brexit campaign, said the court ruling would have no real impact.

“We don’t want to stay in the EU … so this case is very well but it doesn’t alter the referendum vote or the clear intention of the government that we leave on March 29,” Gove told the BBC.

May, meanwhile, was scrambling to change lawmakers’ minds and stave off defeat.

The government insisted Monday that Tuesday’s vote will be held as scheduled, amid pressure to delay it to avoid a defeat that could sink May’s deal, her premiership, or both.

May’s government does not have a majority in the House of Commons, and opposition parties — as well as dozens of Conservative lawmakers — say they will not back the divorce deal that May and EU leaders agreed last month.

Pro-Brexit lawmakers say the deal keeps Britain bound too closely to the EU, while pro-EU politicians say it erects barriers between the U.K. and its biggest trading partner and leaves many details of the future relationship undecided.

The main sticking point is a “backstop” provision that aims to guarantee an open border between EU member Ireland and the U.K.’s Northern Ireland post-Brexit. The measure would keep Britain under EU customs rules, and is supposed to last until superseded by permanent new trade arrangements. Critics say it could leave Britain tied to the EU indefinitely, unable to strike new trade deals around the world.

May and the EU both insist the withdrawal agreement can’t be changed. But May spoke over the weekend to European Council President Donald Tusk, who will chair an EU summit in Brussels on Thursday, and Irish Prime Minister Leo Varadkar, amid signs she is seeking to tweak the deal to win over skeptical lawmakers.

“Of course we can improve this deal, and the prime minister is seeking to improve this deal,” Gove said.

But, he warned, “by reopening it, there is a risk that we may not necessarily get everything that we wish for.”