The Supreme Court has ruled that parts of two Bills passed by MSPs are outside the legislative competence of the Scottish Parliament.
The United Nations Convention on the Rights of the Child (Incorporation) (Scotland) Bill and the European Charter of Local Self-Government (Incorporation) (Scotland) Bill were passed earlier this year.
However, the UK Government referred the Bills to the Supreme Court over technical aspects of the legislation which they said may have placed legal duties on UK ministers.
Following the ruling announced on Wednesday, the Bills will return to the Scottish Parliament so they can receive further consideration.
Deputy first minister John Swinney indicated that the ruling means it is not within the power of Holyrood to pass laws considered necessary to protect the rights of children.
“While we fully respect the court’s judgment, it lays bare the weakness of, and the limits in, the devolution settlement,” he said.
“The ruling means it is outwith the power of the Scottish Parliament to pass legislation it considers necessary to fully ensure the rights of Scotland’s children are protected.
“The UNCRC Bill was created to deliver a revolution in children’s rights, making sure children and young people are involved in decisions that affect their lives.”
Swinney said that he will provide an update to Holyrood, as he said the devolution settlement “does not give Scotland the powers it needs”.
He continued: “The Bill was backed unanimously by the Scottish Parliament and celebrated as a landmark by campaigners across the country.
“The European Charter of Local Self-Government Bill strengthens local government by incorporating the Charter into Scots law.
“Starting as a Member’s Bill, it, too, was passed unanimously by the Scottish Parliament and it was supported by local government and COSLA.”
He added: “Today’s judgment will require careful consideration. I will update Parliament further later today, but one thing is already crystal clear: the devolution settlement does not give Scotland the powers it needs.”
Scottish secretary Alister Jack said the UK Government will continue to “work collaboratively” to address any competence concerns in future Holyrood legislation.
“I welcome the UK Supreme Court’s decision, which provides vital legal clarity on these two Bills,” he said.
“As set out in the Scotland Act 1998, the Scottish Parliament cannot legislate outwith its areas of competence.
“As we have been clear, our concerns were never to do with the policy of the Bills, but about whether they are within the legislative competence of the Scottish Parliament.
“We will continue to work collaboratively with the Scottish Government to address any competence concerns with future Scottish Parliament legislation.”
Scottish Greens human rights spokesperson Maggie Chapman said: “This is a dark day for democracy in the UK.
“The fact the UK Government has used the courts to overturn a decision by the Scottish Parliament to protect the rights of children reveals their disregard for human rights and their true intentions when it comes to respecting the will of the devolved nations.”
Scottish Labour’s constitution spokesperson Sarah Boyack said it is “shameful” that the Scottish Government and the UK Government had let the “fiasco undermine meaningful and progressive legislation”.
“This court case has been a needless distraction from what really matters,” she said.
“This damning verdict makes it clear that the SNP have been playing cynical political games at the expense of children’s human rights.
“This never should have been about petty constitutional bickering – it should have been about putting children’s rights front and centre and empowering our councils to make decisions in their communities.
“It is shameful that both sides have let this fiasco undermine meaningful and progressive legislation. Scotland deserves better.
“The SNP must act urgently to get these laws fit for purpose and in place, so we can focus on how to make these principles a reality.”
Bruce Adamson, children and young people’s commissioner Scotland said: “The Supreme Court has today clarified the limits of the powers of the Scottish Parliament, but this must not limit the commitment made by the Scottish Government to take a maximalist approach to the incorporation of children’s rights as far as devolution allows.
“Children and young people and other human rights defenders have been campaigning for decades to incorporate the UNCRC into Scots law.
“It is the most important thing we can do to ensure children’s rights are respected, protected and fulfilled.”