AND so it begins.

Yesterday, after months of fruitless wrangling about the “Westminster power grab” the UK Government finally took Holyrood to court – the Supreme Court. As in divorce, when negotiation fails the only recourse is to call in the lawyers, if only to safeguard the welfare of the children. And the Continuity Bill is essentially about custody of the powers of the Scottish parliament.

However, many Scottish nationalists see this as the prelude to a more fundamental divorce, if the response on social media is any guide. There’s a widespread assumption that this is Westminster starting to roll back devolution and impose a form of constitutional dictatorship over the Scottish Parliament. It may come to that. But the immediate question before the Supreme Court – whether Holyrood has the right to pass a Continuity Bill in the first place – may not go the way the UK Government hopes.

This Supreme Court case, unlike the one on Article 50 in 2016, is not directly about the Sewel Convention: the rule that Westminster should not normally legislate in devolved areas without the consent of Holyrood. That will come later. Most constitutional authorities, like Professor Alan Trench, of UCL, believe that, on the narrow point of Holyrood’s competence to pass the Continuity Bill, the UK Government might very well lose. But it will assuredly win in the end.

READ MORE: UK government challenges devolved Brexit legislation

The Continuity Bill was passed by an overwhelming majority in the Scottish Parliament, and it essentially seeks to place the powers repatriated from Brussels under the joint control of the Scottish Parliament and Westminster, and not just at the disposal of the UK Prime Minister. The Scottish Government says it wants equal control over them – power-sharing, if you will.

It’s partly about those rules on chlorinated chickens and GM crops which the UK Government insists have to be set for the whole of the UK, but it’s also about money. For example, under EU farming support, Scotland receives approaching half a billion pounds a year in subsidies, far higher than a Barnett population share. The UK Government wants to change farm subsidies or abolish them altogether after 2021.

There are 111 powers of the Scottish Parliament which will change after Brexit, and many of them could involve confrontations between Holyrood and Westminster. These include onshore carbon licensing or fracking, state aid rules and animal welfare. On most issues, there can be agreed frameworks, but on contentious ones, Westminster thinks it should have the ultimate say on rules that apply across the entire UK.

READ MORE: SNP accused of hypocrisy after failing to disclose meeting with Cambridge Analytica

Westminster believes it is constitutionally within its powers to take control of these responsibilities, even though under a strict interpretation of the 1998 Scotland Act, all the powers repatriated from Brussels automatically become powers of the Scottish Parliament. Even the House of Lords Constitution Committee agrees on this.

That’s the underlying issue, but confusingly, it is not what the Supreme Court judgement will be about – at least not in the first instance. Prepare to be mightily confused as the Lord Advocate for Scotland, James Wolffe, and the Advocate General, Lord Keen, lock horns over what seems like a bizarre side issue: does Holyrood have the right to pass laws about laws that haven’t happened yet?

The Presiding Officer, Ken Macintosh, has said he thinks the Continuity Bill is beyond the competence of the Scottish Parliament because “it assumes that the Parliament can make provision now for the exercise of powers which it is possible the Parliament will acquire in the future”. The Lord Advocate responded on the contrary that “it is compatible with EU law to make provision, in the way that this Bill does, for what is to happen when EU law no longer applies”.

The bill in effect mirrors the EU Withdrawal Bill which is currently going through Westminster, which is designed to import all the 40 years’ worth of regulations and directives from Brussels and incorporate them, en masse, into UK law. The Scottish Government thinks that Holyrood needs its own withdrawal bill for the devolved areas, hence “continuity”.

However, the Continuity Bill would remove the right of the UK Prime Minister to unilaterally make changes to these regulations as they are repatriated. This is the contentious Clause 11 of the EU Withdrawal Bill, currently stalled in Westminster. Moreover, the Continuity Bill gives Holyrood the power to remain under EU law, as it affects devolved legislation, for up to five years after Brexit.

The Government could of course amend the EU Withdrawal Bill to give Holyrood equal say, but Lord Keen says that individuals and businesses had to have “legal certainty” about the future. The UK Government, in short, doesn’t want to give Holyrood anything resembling a veto on changes to EU regulations immediately after Brexit. It needs the power to bend these repatriated laws into shape and doesn’t want Holyrood sticking its oar in.

Even if the Supreme Court rules that Holyrood has the competence to pass the Continuity Bill, the UK Government can still try to impose legislative consent. The constitution is a power reserved to Westminster and its decision is final. But the question is: would Westminster actually want to do this? Would the House of Lords choose effectively to abolish devolution in order to make life easier for the UK Prime Minister after Brexit?

READ MORE: UK government challenges devolved Brexit legislation

Conservative MPs say this is all about SNP troublemaking. But the original idea of a Continuity Bill came from the Labour administration of Carwyn Jones in Wales. Arguably, this is not about abolishing the Union, but entrenching it in law. If the Scottish Government is successful, Holyrood could end this legal process looking much more like a federal state government, with legally defined powers that Westminster cannot take away.

This is an aspect that many Unionists don’t understand, and most Scottish nationalists care little about. Neither side seems to have the will to grasp it and remake the UK constitution as a federation. For different political reasons, they would rather see this as an all-or-nothing power struggle between Holyrood and Westminster. And that’s what it looks like becoming.