LEGISLATION to protect the powers of the Scottish Parliament were resoundingly passed last night.

MSPs heard it was reluctantly introduced amid fears of a post-Brexit “power grab” by the UK Government.

Analysis: What now for Theresa May, after Holyrood vote sets up UK crisis?

Ruth Davidson’s Conservative MSPs, along with a single LibDem MSP, Mike Rumbles, were the only opponents of the EU Continuity Bill, which passed by 95 votes to 32.

The new legislation will both protect the devolved settlement and prepare Scotland’s laws for the UK’s exit from the European Union.

It will come into effect if the Scottish Parliament decides not to consent to the UK Government’s EU Withdrawal Bill and will prevent what ministers in Scotland and Wales have described as a “power grab”.

READ MORE: Tory peers outraged at SNP for opposing UK power grab

There is currently a stalemate between the UK and Scottish governments over Clause 11 of the Westminster Bill which deals with how powers in devolved areas are distributed when they return from Brussels to the UK.

The Welsh National Assembly also passed similar legislation for devolved matters in Wales yesterday.

Mike Russell, the Minister for UK Negotiations on Scotland’s Place in Europe, was responsible for the Continuity Bill passing through Holyrood.

READ MORE: Archbishop to back power grab on Holyrood

“The Scottish Government is opposed to leaving the EU in line with the overwhelming majority of people in Scotland, but we have a duty to prepare our laws for Brexit,” Russell said after the legislation was passed.

“However, Brexit must not be used by the UK Government as cover to grab powers from the Scottish Parliament and hand them to Westminster.

“I am delighted that the majority of the Scottish Parliament has come together to support devolution.

“The process of working through and improving this Bill has been a credit to our national parliament and demonstrates the strength of feeling over this issue.”

He added: “The parliament has been clear that it could not recommend consent to the UK Government’s EU Withdrawal Bill, as it stands, as it allows the UK Government to unilaterally take control of devolved powers.

“We are still committed to discussions with the UK Government. We now expect them to acknowledge the overwhelming view expressed by the Scottish Parliament – and the Welsh National Assembly – and come forward with proposals that respect the devolution settlement and allow us to come to an agreement.”

Ahead of the final stage of the Bill, Adam Tomkins, the Tories’ constitution spokesman, introduced a Union amendment, designed to put pressure on Labour.

The amendment would have meant that laws passed by the Scottish Parliament affecting trade would have had to comply with any new UK laws.

He said it was needed in order to “protect” the UK’s internal market.

The move backfired however, when Labour, most of the LibDems and the Greens supported the Scottish Government and the overriding need to protect devolution.

During the debate, SNP MSP Bruce Crawford pointed out the UK market operated already with different rules in a range of areas.

He said: “What if we did not already have in place the minimum pricing legislation and the anti-smoking legislation?

“What about changes to future income tax rates — which the Tories argue will in some way undermine Scotland’s relationship with the rest of the United Kingdom right now, before we even pass this bill?

“What about differential support in agriculture, which already exists but probably could not exist in the future if amendment 14 were to be agreed to?”

Labour’s Brexit spokesman Neil Findlay said: “The passing of this legislation should finally alert the UK Government to fix the mess they have made of the EU Withdrawal Bill.”