LONDON/EDINBURGH (Reuters) - Scotland’s devolved parliament partially overstepped its constitutional reach when it passed a Brexit bill designed to ensure it kept all its powers after Britain leaves the European Union, the British Supreme Court ruled on Thursday.

FILE PHOTO: Scotland's First Minister Nicola Sturgeon takes part in a press conference at Bute House in Edinburgh, Scotland, Britain November 27, 2018. Andy Buchanan/Pool via REUTERS/File Photo

Britain’s government asked the Supreme Court in April to rule on whether bills on regional powers after Brexit, passed by the Scottish and Welsh parliaments, were constitutionally sound. They argued the bills could cause legal confusion.

The Supreme Court ruled that the whole of the Scottish Bill was not outside the devolved parliament’s legislative competence but some parts were.

The case has highlighted the fragile state of relations between Britain’s government and Scotland which have been stretched further by tensions over Brexit.

Powers currently devolved to Scotland and Wales, in areas such as agriculture, fisheries and food standards and labelling -- which are administered now by the EU -- will come back to the national parliament once Britain leaves the bloc.

A majority of Scottish voters backed remaining in the EU and many are angry over Prime Minister Theresa May’s Brexit plans.

Both sides claimed victory after Thursday’s ruling.

Nicola Sturgeon, Scotland’s first minister, said it vindicated her government’s approach to Brexit.

Her constitutional relations minister, Michael Russell, accused London of “constitutional vandalism” by passing Brexit legislation without the consent of the Scottish parliament.

But Britain’s Scotland minister David Mundell said the ruling brought “much-needed legal clarity that the Continuity Bill goes beyond the powers of the Scottish parliament.”

“It is now for the Scottish government to consider how to proceed, and we hope Holyrood will take a pragmatic approach and work constructively with us as we leave the EU,” he said.

(This story was refiled to add dropped word ‘court’ to headline)