Brexit is every bit as disastrous for Scotland as it is for England. If you play through the options ahead for Scotland, none of them end well.

On the one hand, Brexit gives far greater legitimacy to the independence movement. If the goal is independence at all cost, then that is now a far more likely outcome.

But the path to a happy, independent, social-democratic and internationalist Scotland within the EU looks extremely difficult – perhaps even impossible. There is no way for the EU to make a side-deal with Scotland, so that it somehow remains within the EU while England and Wales exit. That doesn’t work legally – in the current treaty framework, the EU can’t reach an agreement with part of a member state, nor promise membership outside of the regular accession process. And it doesn’t work politically – although many within the EU are sympathetic to Scotland, any agreement would need the consent of 27 EU states, several of which (Spain, most notably) have a political imperative not to play ball, due to their own internal fissures.

So Scotland would have to Brexit as part of the UK, then hold an independence referendum and get its own constitutional house in order, and then go through the pain of the EU accession process (including adopting 70,000 pages of EU legislation and building a whole swag of institutions that don’t currently exist in the devolved administration). Who knows how long that process would take, but it can’t be less than, say, 6-8 years, during which Scotland would be fully exposed to the economic costs of Brexit. And at the end of the process, it would still face the risk of being blackballed by Spain.

And that still leaves the tricky question of what it would mean to be an independent Scotland in the EU, geographically hitched to a rump Britain outside the EU. There are two obvious problems here. One was explored pretty thoroughly at the time of the last independence referendum: in the face of declining oil and gas revenues and without subsidies from Westminster, the Scottish social democratic model may prove to be unaffordable. The second is that, if England leaves the common market and Scotland joins the EU, then we have a customs border between the two countries for the first time in, what, 300 years? The Scottish and English economies are highly integrated. According to surveys done during the last independence referendum, Scotland exports £50 billion in goods and services to the rest of the UK, compared to just £12 billion to the rest of the EU. Big Scottish service companies like Standard Life have 90% of their customers in England. While the figures are a bit ropey, they suggest that the economic costs of separating from England would far outweigh the benefits of reintegrating with the EU.

And this couldn’t be fixed by a deal between the two countries. As an EU member, Scotland could no longer negotiate its own trade deals (that’s the loss of control bit, right?). And England would be obliged to trade with Scotland on the same terms as it trades with the rest of the EU.

This is the bitter irony for Scotland. Independence where both countries remained EU members was a viable prospect. Independence post-Brexit may not be.

(There are similar problems ahead for Ireland, but that’s a topic for another day.)

I imagine Nicola and her colleagues are doing their own versions of these calculations and realising how limited their options have become. How angry they must be at the cavalier way in which Westminster has trampled all over their rights and aspirations. The injustice of it won’t be quickly forgotten.

But if they can master their anger, their best play is surely to reengage with Westminster politics in advance of the election. Nicola is by far the most capable and credible politician on the progressive side of British politics. She is uniquely placed to cobble together an anti-Brexit platform, uniting the fractured left-of-centre parties into some kind of non-competition pact – perhaps with the promise of proportional representation to sweeten the deal. I doubt that such a pact would win an outright majority. But it might win a strong enough position in parliament to kick Brexit into the long grass for a while – perhaps long enough for us to find a different way out of this mess.