Media playback is unsupported on your device Media caption Lord Hodge delivered the Supreme Court ruling

Judges at the UK's highest court have ruled against the Scottish government's Named Person scheme.

Opponents of the scheme appealed to the Supreme Court in London after their case was dismissed by the Court of Session in Edinburgh last year.

The system would appoint a named person - usually a teacher or health visitor - to ensure the wellbeing of every child.

Judges say some proposals breach rights to privacy and a family life under the European Convention on Human Rights.

The court said the aim of the Act, which is intended to promote and safeguard the rights and wellbeing of children and young people, was "unquestionably legitimate and benign".

However, judges said specific proposals about information-sharing "are not within the legislative competence of the Scottish Parliament".

And they said the legislation made it "perfectly possible" that confidential information about a young person could be disclosed to a "wide range of public authorities without either the child or young person or her parents being aware".

'Greater clarity'

The Scottish government has said it will not commence the legislation until the problems are fixed - meaning it will be delayed until after its intended implementation date of 31 August. It is understood the government still hopes to roll out the system before the end of the year.

Education Secretary John Swinney said the government would move to "provide greater clarity" about information-sharing and would start work immediately on the necessary legislative amendments.

The Scottish government has also indicated that proposed changes to the named person legislation would be scrutinised by MSPs at Holyrood, which is in recess until the start of September.

A spokesman for the group that launched the challenge said the "state snooper" scheme had been "blocked" and the government must go back to the "drawing board".

He called for "intrusive data-sharing powers" to be scrapped.

Image copyright Thinkstock Image caption Campaigners fear the scheme will cause unnecessary intrusion into family life

Analysis by BBC Scotland home affairs correspondent Reevel Alderson

The ruling by Supreme Court judges - two of whom are Scottish - does not mean the controversial Named Person legislation cannot ever be implemented.

It simply means the Scottish government must make some changes to the law to ensure it complies fully with the European Convention on Human Rights (ECHR).

The charities opposed to the scheme had already seen judges at the Court of Session in Edinburgh rule on two occasions that it could go ahead.

The appeal to the UK Supreme Court was on a claim that it breached ECHR.

The judges said in general terms the law - part of the Children and Young People (Scotland) Act 2014 - did comply.

But they ruled some changes are required to the scheme.

In particular the way in which information could be shared by named persons and others was ruled non-compliant.

The court has said the Scottish government must provide greater clarity about how health visitors, teachers and other professionals who will be Named Persons will share and receive information in their role.

Ministers said they will start work on this immediately.

Although the provisions of the legislation were due to be implemented at the end of August 2016, it will now be delayed until changes can be made.

Image copyright Thinkstock

Why was the legislation challenged?

The Scottish government contend that the system would help to protect young people and has accused opponents of misrepresenting the legislation, which was approved by 103 votes to nil by MSPs when it formed part of the Children and Young People Act in 2014.

The Supreme Court heard two days of evidence in March on the case.

The appeal was brought by the No to Named Persons (NO2NP) coalition, which includes the Christian Institute, Care (Christian Action Research and Education), Tyme Trust and the Family Education Trust.

They tried to convince the panel of five Supreme Court judges that the named person legislation authorised "unjustified and unjustifiable state interference with family rights".

Their arguments had previously been dismissed as "hyperbole" by the Court of Session, which said named person did not diminish the role of parents and had "no effect whatsoever on the legal, moral or social relationships within the family".

And while the Supreme Court did not oppose the legislation in principle, it said information-sharing proposals interfered with privacy and family life.

NO2NP spokesman Simon Calvert said he was "delighted" with the court's decision, saying it "proves our concerns were properly founded".

He added: "This proposed scheme was intrusive, incomprehensible and illegal.

"This ruling means the Scottish government has been blocked from implementing this scheme on 31 August. It must scrap its plan for state snoopers with intrusive data sharing powers. It has to go back to the legislative drawing board.

"The Big Brother scheme is history."

Why does the Scottish government want to introduce named person?

Image copyright inarik Image caption Every child in Scotland will have a named person from birth until the age of 18

The Scottish government wants Scotland to be "the best place in the world for children to grow up".

It has said that most children and young people get all the help and support they need from their parents, wider family and community, but sometimes they might need a bit of extra support.

As part of its Getting it Right for Every Child strategy, the government proposed giving all children and young people from birth to 18 years access to a named person under the Children and Young People (Scotland) Act 2014.

The Scottish government says the named person is intended to be single point of contact if a child or their parents want information or advice, or if they want to talk about any worries and seek support.

They will also be a point of contact for other services if they have any concerns about a child's wellbeing.

The law had been due to come into force across the country on 31 August of this year, although the policy had already been rolled out in parts of Scotland, including Highland, Edinburgh, Fife, Angus and South Ayrshire.

Mr Swinney said the government would start work to amend the legislation "immediately", so that the scheme can still be rolled out "at the earliest possible date".

He welcomed the judgement as a sign that "the attempt to scrap the named person service has failed".

Read more about named person here

What do other parties think?

Image copyright PA Image caption The ruling will be delivered at the Supreme Court in London

Scottish Conservative leader Ruth Davidson said the ruling was "important" and "a victory for campaigners" against "illiberal, invasive and deeply flawed" legislation.

She added: "Simply put, the SNP does not know better than parents when it comes to raising their children.

"We have consistently argued against the named person legislation on grounds of principle and practicality.

"I hope today's ruling will make the SNP stop and think again."

Image copyright Scottish Parliament Image caption The Lib Dems have called for Holyrood to be recalled to consider the changes to the legislation

Labour is broadly in favour of named person in principle, but has previously called for a "pause" to ensure it is introduced "properly and proportionally".

Education spokesman Iain Gray said the handling of the scheme had been "a shambles from the very beginning".

He said: "Labour will always support the need to protect vulnerable children and ensure that families get the support they need and deserve.

"In light of this ruling, however, the implementation of this scheme must be paused for as long as it takes to sort it properly. That is the case Scottish Labour have made for many months now and it is more compelling than ever following the court decision."

Ross Greer of the Scottish Greens said his party would continue to give its full support to named person, but called on the Scottish government to do more to build public confidence and better explain what the scheme means in practice.

The Scottish Liberal Democrats submitted a motion calling for parliament to be urgently recalled.

Education spokesman Tavish Scott said: "A recall of parliament is the only way to ensure that reforms receive the scrutiny required. This is not a decision for a minority minister to make in his office. It needs full parliamentary approval."