HOLYROOD has passed a Bill intended to elbow aside Brexit legislation at Westminster and prevent a “power grab” in a controversial first for devolution.

MSPs voted 95 to 32 in favour of the EU (Legal Continuity) Bill after the Scottish and UK governments failed to agree on the distribution of devolved EU powers after Brexit.

Only one LibDem MSP and the Scottish Tories, who tried unsuccessfully to insert a ‘Union guarantee’ to freeze Holyrood’s powers after the UK leaves the EU, opposed the emergency legislation, which has been fast-tracked through parliament in three weeks.

It is the first Holyrood Bill passed against the advice of the Presiding Officer.

Ken Macintosh said the legislation was ultra vires because it strays into EU law, while SNP ministers, backed by the Lord Advocate, insisted it was competent and pressed ahead.

The UK government law officers are now likely to refer the Continuity Bill, and a Welsh equivalent passed in Cardiff, to the UK Supreme Court and ask it to rule it illegal.

It would be the first time the UK government has attempted to overturn a Holyrood Bill.

The vote by MSPs follows months of wrangling between Edinburgh and London over a “power grab” contained in the EU Withdrawal Bill at Westminster.

The UK government wants 24 key devolved policy areas being repatriated from Brussels to lie at Westminster after March 2019, to allow the creation of UK-wide common frameworks in fields such as agriculture, fishing, the environment, food standards, and procurement.

The Scottish Government wants frameworks agreed by consent, not imposed, something the UK has resisted as it would amount to Holyrood having veto powers over Westminster.

The Continuity Bill is a fallback measure which would transfer devolved EU law into Scots law at Brexit if the two governments cannot resolve their differences by May, the deadline for amending the EU Withdrawal Bill in the House of Lords.

With both sides refusing to move on what they see as issues of principle, the UK government is expected to start the ball rolling on a Supreme Court fight in case there is no agreement.

SNP Brexit Minister Michael Russell said his clear preference remained a deal on the EU Withdrawal Bill, but that legislation would have to be heavily amended first.

He said London had tried to “redesign devolution” unilaterally, adding: “It was clear at the outset this was never going to get the agreement of any devolved administration worth its salt. It was obviously incompatible with the devolution settlement in Scotland and in Wales.”

He said: “Today starts a new chapter in this story. The Scottish and Welsh parliaments will be armed with an alternative to the way in which the United Kingdom government wishes to treat devolution. We will not go naked into the negotiating chamber any longer.

“We have an ability to negotiate based on an alternative which we have put in place ourselves. We can and we will make this Bill work if we have to.

“So now the ball is firmly in Westminster’s court. If they want to come to the table and discuss these issues - and I hope they do - they know we have the alternative.

“Let us now see what takes place.”

He said the Continuity Bill would ensure Scots law operated effectively following EU withdrawal if Holyrood could not give legislative consent to parts of the UK Bill.

He said that if there was a future deal between the Scottish and UK governments, it would have to be approved by MSPs, with MSPs also scrutinising repeal of the Continuity Bill.

A UK Government spokesperson said: “Our focus continues to be on finding an agreed way forward with the devolved administrations on the EU (Withdrawal) Bill. Everyone agrees this is the preferred option. As with all Scottish Parliament bills, the competence of the Continuity Bill will be considered by the Law Officers.”

In one of the most dramatic moments of the final Stage 3 debate, LibDem MSP Mike Rumbles dissented from party colleagues to announce he would vote against the Bill.

He said he believed it would be referred to the Supreme Court and found illegal, and he wanted “no part” of legislation that would “greatly damage” Holyrood’s reputation.

Tory MSP Adam Tomkins said the Bill was “bad law”, reckless, unwelcome and unnecessary.

He said: “It’s real purpose is to create legal chaos and legal confusion.”

He also said it contained an “odious” section giving ministers sweeping post-Brexit powers, and claimed ministers had been “strong-arming” members of a scrutiny committee.

He challenged the Lord Advocate to seek a ruling on the legality of the Bill at the Supreme Court if he and SNP ministers were so confident it was within Holyrood’s powers.

Tory MSP Murdo Fraser said all the powers the SNP complained would go to Westminster under the UK legislation would stay in Brussels under the SNP’s plan to remain in Europe, while Tory Donald Cameron said MSPs would not be respecting devolution by passing “this wretched, reckless and lamentable legislation”.

Labour MSP Neil Findlay said the “messy” Bill had been “avoidable” but the Tories had failed to amend the EU Withdrawal Bill in the House of Commons as they had promised.

He said: “We should not easily forget it was the Tories who have gotten us into this mess and time is running out for them to get us out of it.”

He said: “Labour has offered cautious support to this legislation but not a blank cheque to the Scottish Government to further a narrow political agenda around the constitution.

“We are in this mess because of the shambolic handling Ruth Davidson and David Mundell made of the EU Withdrawal Bill, which presently fails to respect the devolution settlement.

“Labour sought to amend this legislation to protect the vital UK single market, but we recognise that the biggest threats to the UK since 2015 have been the actions of increasingly irresponsible Tory governments.

“The passing of this legislation should finally alert the UK government to fix the mess they have made of the EU Withdrawal Bill.”

LibDem MSP Tavish Scott said he hoped the Bill would quickly become “redundant”, with the UK and Scottish governments agreeing a deal on devolved powers instead.

Earlier, an attempt by the Scottish Conservatives to guarantee the “precious Union” after Brexit, by keeping Scottish laws and policies in step with the rest of the UK, badly backfired.

Instead of uniting parties against the SNP, it united every other party against the idea.

Mr Tomkins said Labour was helping the SNP to “undermine the Union” and was “increasingly untrustworthy on the Union”.

Mr Findlay said Mr Tomkins was acting for his party “paymasters”.