Britain's plans for Brexit have just been thrown into disarray.
The U.K. High Court ruled that Prime Minister Theresa May's government cannot begin the formal process of taking Britain out of the European Union until it gets the nod from members of parliament (MPs).
People who want the U.K. to remain in the EU shouldn't get too excited, however. Experts say Brexit is still almost certain to happen... it just may take longer, and look rather different.
Here's a step-by-step guide to what will happen next on this long and winding road:
Heading to the Supreme Court
The government will appeal the judgment. The Supreme Court is likely to hear the case in early December and issue a ruling by early January.
Here's what's at stake: The government wants to start formal exit negotiations with the EU by the end of March 2017, triggering Article 50 of the EU treaty that would start a two-year countdown to Brexit.
If the Supreme Court overturns the High Court ruling, May will be able to trigger Article 50 whenever she wants. But if it upholds the ruling, May will have to seek approval from members of parliament before taking that first step. That could drag things out.
Related: 4 things that could slow down the break-up
Many MPs, including May herself, were opposed to leaving the EU, so they could in theory vote to stop Brexit. Experts say that won't happen because the majority of the British public backed Brexit in a June referendum.
"I think it's inconceivable that parliament will block the triggering of Article 50," said professor Anand Menon, an expert in European politics at King's College London.
Strings attached
If May is forced to get parliamentary approval, she has two options, according to David Greene, a partner at Edwin Coe and a leading lawyer on the Brexit case.
She could bring forward a simple "motion," requiring a yay-or-nay answer from MPs. Or her government could propose legislation, which could be amended by lawmakers seeking to influence the terms of Brexit.
"Parliament may be able to tie the government's hands in the [EU] negotiations," wrote Menon in a recent report.
It could, for example, force the government to seek continued membership of the European single market -- the free trade area of 500 million people -- after Brexit, or to give parliamentary committees powers to review the talks.
Related: Brexit is going to happen, but now 48% of voters have a voice
MPs could also require that the government reveals its Brexit negotiation plans before triggering Article 50, said Nick Barber, an associate professor of constitutional law at the University of Oxford.
The two-year deadline
Assuming the government eventually gets parliamentary permission to trigger Article 50 and May presses the Brexit button, then negotiations with the EU would begin.
The government will have to negotiate on issues related to trade, investment and immigration. According to EU rules, this process lasts for exactly two years. Then the U.K. would officially leave the EU.
Related: See how U.K. trade stacks up
It will be a hugely complex task to unwind Britain's 40-year relationship with its biggest trading partner. And there may not be enough time to resolve all the questions this unprecedented move will raise, including finalizing a new trade agreement.