THERESA May’s government has provoked a constitutional crisis after asking the Supreme Court to strike down Holyrood’s Brexit Continuity Bill.

The legislation received the backing of just about all SNP, Labour, Green and LibDem MSPs in the Scottish Parliament last month.

Only the Tories and a solitary LibDem MSP opposed when Holyrood voted on the Scottish Government’s rebel Brexit bill.

However, there were clashes between the parliament’s presiding officer and Scotland’s top lawyer on the legality of the bill.

Ken Macintosh said he believed the legislation was outwith Holyrood’s competence. The Lord Advocate, James Wolffe, disagreed.

The UK Government's senior law officers, the Attorney General and the Advocate General for Scotland, have now asked the Supreme Court to rule on the issue.

Lord Richard Keen, the Advocate General for Scotland, said: "By referring the Scottish Parliament's Continuity Bill to the Supreme Court, we are seeking legal certainty as to its competence.

"Given the presiding officer's view at introduction that the bill was not within the legal scope of the parliament, we believe it is important to ask the court to provide absolute clarity.

"In doing so we are following the process set out in the Scotland Act 1998. Particularly in the run up to Brexit, it is vital that we avoid legal uncertainty in our statute book."

Scotland's Brexit minister, Michael Russell, said the government was satisfied that "the Bill is within legislative competence."

He added: “The Lord Advocate will be arguing in the Supreme Court that it is within the powers of the Scottish Parliament to prepare for the consequences for devolved matters of UK withdrawal from the European Union.

“Our Continuity Bill is an important and necessary piece of legislation to prepare Scotland’s laws for Brexit while protecting the powers of the Scottish Parliament that people voted for.

“The Scottish Government has made clear it cannot recommend the Scottish Parliament consent to the Withdrawal Bill in its current form. 

“Alongside the Welsh Government, we have always said our preference would be to reach an agreement with the UK Government to amend the EU Withdrawal Bill to respect the powers of the devolved administrations and both Governments are ready to  continue meaningful talks to further discuss potential solutions.

“While the Scottish Government is not opposed to UK-wide frameworks in certain areas when these are in Scotland’s interests, this must only happen with the agreement of the Scottish Parliament.”

Both the Scottish and Welsh governments put forward their own Continuity Bills after the UK government failed to amend Clause 11 of the EU Withdrawal Bill, described by both Nicola Sturgeon and Carwyn Jones as a power grab.

That bill is currently in the Lords, and is likely to finish its process through the UK Parliament and be signed off by the Queen at some point in May.

The devolved administrations say it is essential that their continuity bills become law before the EU withdrawal bill does.

When Russell introduced the Scottish bill in Holyrood last month, he told MSPs: “In the absence of an agreement about a common UK approach and in defence of devolution, this parliament must prepare itself to assert, if it has to, the right to legislate itself about the devolved consequences of EU withdrawal."

The Scottish minister warned: “Without it, not only are we defenceless but our negotiating position as a government is severely weakened. We must not only have options and choices, we must be seen to have options and choices.”

The legislation was fast-tracked through the Scottish Parliament on a shortened timetable.

Defending the Bill, Wolffe said it had been "carefully framed".

He argued that if it was outwith the remit of parliament then so too was the EU Withdrawal Bill being put forward in Westminster.

The key legal issue centres over timing and if the Continuity Bill is compatible with EU law when enacted, as required by the Scotland Act 1998.

Wolffe told Parliament that with Brexit day coming next March, there was "an urgent practical necessity to make provision... to enable the law to operate effectively immediately upon and after the UK's withdrawal from the EU".

He added: “The legal obligation on ministers to comply with EU law will endure until the UK leaves the EU. This Bill does not change that obligation.

“Ministers will continue to be subject to legal requirements to transpose, implement and otherwise abide by EU law so long as the UK remains a member of the EU. This Bill does not alter those requirements.

“The Bill does nothing which will alter European Union law or which undermines the scheme of EU law while the UK remains a member of the EU.

“What the Bill does is to make provision for the continuity of the law immediately upon and following withdrawal from the EU.”

Wolffe insisted: “It is not incompatible with EU law to make provision to deal with the inevitable consequences in domestic law of withdrawal from the EU in this way.

“Indeed that appears to be the basis upon which the UK Government’s own EU Withdrawal Bill, upon which this Bill has been modelled, proceeds.

“If that is right and if contrary to the view of the Scottish Government this Bill is incompatible with EU law then the same reasoning would apply equally to the UK Government’s Bill.”

The UK Government's EU Withdrawal Bill is effectively supposed to take the UK out of the EU, and transfer all laws and powers from Brussels to Britain.

The problem is that Clause 11 of that bill automatically transfers those new powers to Whitehall, even if they are already in a devolved area.

The Scottish and Welsh governments have both indicated that they can not agree to this, and despite some agreement, say they cannot recommend the bill be given consent.

Ministers in Edinburgh and Cardiff insist they still want to reach an amicable solution with Whitehall, and that the continuity bill is a contingency plan.