The European Court of Justice has ruled the UK can cancel Brexit without the permission of the other 27 EU members.
The ECJ judges ruled this could be done without altering the terms of Britain’s membership.
A group of anti-Brexit politicians argued the UK should be able to unilaterally halt Brexit, but they were opposed by the government and EU.
The decision comes a day before MPs are due to vote on Theresa May’s deal for leaving the EU.
MPs are already widely expected to reject the proposals during a vote in the House of Commons on Tuesday night.
BBC Brussels correspondent Adam Fleming said the ruling made staying in the EU “a real, viable option” and that may “sway a few MPs” in the way they vote.
But he said “a lot would have to change in British politics” to see the UK remain in the EU, with Mrs May and the government having to change its mind to make it a “political reality”.