Image caption Brexit Secretary Mike Russell told MSPs that the UK government's proposal was "unprecedented, unequal and unacceptable"

The Scottish Parliament has refused to give its consent to the UK's main piece of Brexit legislation.

The Scottish and UK governments are at odds over the EU Withdrawal Bill and what it could mean for devolved powers.

Labour, Green and Lib Dem MSPs united to back SNP members in rejecting the Westminster bill, saying it would restrict Holyrood's powers.

The Scottish Conservatives voted against, and have blamed the SNP for the failure to find an agreement.

MSPs voted by 93 to 30 that Holyrood "does not consent to the European Union (Withdrawal) Bill".

Westminster ultimately has the power to introduce the legislation without the consent of Holyrood - but it would be politically difficult, and has never been done before.

Speaking after the vote, Scotland's Brexit secretary, Mike Russell, urged the UK government to respect the will of the Scottish Parliament and find an acceptable solution.

He said: "The Scottish Parliament has now said overwhelmingly that this attempt to undermine devolution is unacceptable.

"The UK government cannot ignore the reality of devolution or try to drown out what this parliament says. They cannot pretend that no motion has been passed."

Both the Scottish and UK governments insist that the door is still open to finding a deal, although both sides also admit they remain some distance apart.

Scottish Conservative constitution spokesman Adam Tomkins said that the UK government had already made "radical" changes to the bill which had resulted in the Labour government in Wales dropping its opposition to it.

And he said it was "profoundly regrettable" that a deal had not been done between Scottish and UK ministers, saying that "the only government that hasn't compromised is the Scottish government".

Analysis by Sarah Smith, Scotland editor

Image caption Nicola Sturgeon told BBC Scotland ahead of the vote that she still hopes a deal can be reached with the UK government

The Scottish government insists this is a highly significant moment, as it is the first time the Holyrood parliament has ever refused consent to a piece of Westminster legislation which is likely to be imposed anyway, without consent.

It is certainly a constitutional first - but one that can be overcome by Westminster.

The UK government has the authority to simply impose the Brexit legislation on Scotland, even if that is politically problematic. It would overturn 20 years of constitutional convention and precedent.

This prime minister has ignored the will of the Scottish Parliament before. This time last year it voted in favour of a second indyref and the PM said no. There was no noticeable uprising of popular outrage then. And there is unlikely to be so now.

Nicola Sturgeon rarely shies away from a fight with Westminster. It's generally good politics for her to say she is "standing up for Scotland" against ministers in London. She hopes it helps build the case for why Scotland would be better off as an independent country.

Her problem is that this argument has not caught voters' attention. The right of the Scottish Parliament to have a definitive say over regulations governing the use of pesticides does not appear to cause great concern to Scots.

Some may be outraged over the principle of legislation being imposed on Scotland after it has been specifically rejected by their MSPs.

The practical consequences may not amount to much. Yet it is one more headache for Theresa May in the migraine-inducing process of trying to secure a Brexit deal.

Read more from Sarah

What is the "power grab" row about?

Image copyright Reuters Image caption Months of talks between the two governments have failed to reach an agreement

The UK government has published proposals that would see the "vast majority" of the 158 areas where policy in devolved areas is currently decided in Brussels go directly to the Scottish and Welsh parliaments after Brexit.

But it has also named 24 areas where it wants to retain power temporarily in the wake of Britain's exit from the EU, including in areas such as agriculture, fisheries, food labelling and public procurement.

It says the "temporary restriction" on the devolved governments using some of the powers returning from the EU is needed "to help ensure an orderly departure from EU law" and allow the same rule and regulations to remain in place across the whole of the UK.

But the Scottish government argues that it would leave Holyrood unable to pass laws in some devolved areas for up to seven years.

It has produced its own alternative Brexit legislation, which was passed by MSPs in March but is currently subject to a legal challenge by the UK government.

Image copyright Getty Images Image caption The consent vote at Holyrood is the latest step in the long-running powers row between the Scottish and UK governments

During the debate, Mr Russell told MSPs that they needed to defend the progress which has been made in the 20 years of devolution in Scotland.

He said: "It is our job to ensure that it is not cast aside because of a Brexit which Scotland did not vote for and which can only be damaging to our country.

"Today the challenge of Brexit - or rather the challenge of the proposed power grab by the UK government under the guise of delivering Brexit - puts our devolved settlement at risk."

Mr Russell also told MSPs that the Withdrawal Bill would add an "unprecedented, unequal and unacceptable new legislative constraint", taking powers away from Holyrood for up to seven years.

And he said that the consent vote "will not be the end of this process", as it applies only to the bill "as it stands".

What has the UK government said in response?

The UK government's Scottish secretary, David Mundell, said he was "disappointed" by the vote, but said the UK parliament remains sovereign and can proceed regardless.

But he said he remained hopeful that an agreement could still be reached between the two governments.

Mr Mundell said: "It's something that was envisaged by the devolution settlement, that there might be circumstances where consent wouldn't be given.

"That circumstance would permit the Westminster government to proceed with legislation on that basis, and that's what we intend to do because the bill is already in the system.

"Obviously there'll be the opportunity for debate and discussion in parliament, but also I hope between the two governments. I still think we can resolve this issue, and that remains my objective."

What are the other parties saying?

A Scottish Labour amendment calling for "cross-party talks in an attempt to broker an agreed way forward" was accepted, and Mr Russell said he would invite UK ministers to "hear the concerns of all parties" and to discuss "any new ideas".

The party's Brexit spokesman, Neil Findlay, blamed the Conservatives and their "shambolic handling" of Brexit for the failure to reach an agreement.

Scottish Greens co-convener Patrick Harvie hailed the "unity" displayed by SNP, Labour, Green and Lib Dem members saying they would "stand together in defence of the parliament".

Lib Dem Europe spokesman Tavish Scott said the negotiating governments had failed to learn from the "ongoing farce" of Brexit, arguing that leaving the EU was "bad for the UK and bad for Scotland".