The Supreme Court has ruled that parts of a Brexit Bill passed by the Scottish Government would be outside its legislative powers.

Seven justices unanimously held that, although the Bill “as a whole” is not outside the “legislative competence” of Holyrood, the parts of it which would affect UK law would be.

At a hearing in London in the summer, the court was asked to rule on whether the European Union (Legal Continuity) (Scotland Bill) passed in March was constitutional and “properly within devolved legislative powers”.

Announcing the court’s decision on Thursday, its president, Lady Hale, said that one section of the Bill was outside the Scottish Parliament’s powers because it would have the effect of making UK law “conditional” upon the consent of Scottish Ministers.

She also said other sections of the Bill would “modify” provisions of the UK Parliament’s own Brexit bill, which came into force in June.

Lady Hale said: “We wish to make it clear that it is no part of our function to determine or to influence the political questions which underlie this dispute.

“Our role is a purely legal one.”

The issue was referred to the court to seek legal certainty “in the public interest” by the Attorney General and the Advocate General for Scotland, the Government’s senior law officers.

SNP ministers in Edinburgh brought forward the legislation after branding the UK Government’s European Withdrawal Act a “power grab” – fearing this will mean responsibilities they believe should come to Holyrood after Brexit will instead go to Westminster.

When the Bill was passed, Scottish Government ministers insisted it was within Holyrood’s competence – although the Scottish Parliament’s Presiding Officer, Ken Macintosh, ruled against them on this.