What happened to the named person scheme?
The Scottish government has confirmed that its plan to appoint a "named person" for every child in the country has been scrapped. How did we get here, and what does it all mean for young people and their parents?
What is a named person?
The government's proposal was to appoint a "named person" who would monitor the wellbeing of each and every child in Scotland, from birth to the age of 18.
The intention was for this person to be a single point of contact if a child or their parents wanted information, support or advice, and for other services if they had concerns about the child's wellbeing.
The named person would generally be a senior teacher, health visitor or midwife, depending on the age of the child.
The government said this was "a good policy to support the wellbeing of children and young people".
However, opponents of the scheme argued that it was a "Big Brother" style "snooper's charter", which would undermine parents and breach privacy.
Why didn't it happen?
The scheme was part of the Children and Young People Act of 2014, a fairly wide-ranging piece of legislation which also included provision for free school meals for younger pupils and extra help for looked-after children.
The bill was passed with the support of almost all MSPs - the SNP, Labour, the Lib Dems and Greens all backed it, while the Conservatives abstained rather than vote against.
The named person scheme was originally meant to be rolled out across Scotland in 2016, but found itself tied up in legal challenges by campaigners, who pursued it all the way to the UK Supreme Court.
This came to a head in July 2016, when judges ruled against it. While they said the aims of the bill were "unquestionably legitimate and benign", they raised concerns about specific parts of the named person scheme.
At issue were information-sharing plans for how named persons would share details about children with other organisations or professionals such as GPs, where they believed it was likely to help safeguard the child.
The court said these provisions breached rights to privacy and a family life under the European Convention on Human Rights, so were "not within the legislative competency of the Scottish Parliament".
What happened next?
In light of the ruling, ministers called off rolling out the policy across the country - but did not want to concede defeat just yet. They were sure they could fix the problems highlighted by the judges.
Education Secretary John Swinney said work would start "immediately" to make sure the scheme could still be rolled out "at the earliest possible date".
To that end, he put forward the Children and Young People (Information Sharing) Bill, a new piece of legislation to amend the existing act to bring it into line with the court's recommendations.
This was due to be debated by MSPs at the end of 2017, but Holyrood's education committee put the brakes on the process by refusing to move the legislation along until they saw a draft code of practice for named persons.
Mr Swinney set up an expert panel to draw up this code, but warned that waiting to do this would "significantly delay" the scheme.
What did the panel say?
After lengthy consideration, the experts came back with the conclusion that there was essentially no straightforward way of coming up with a draft code.
It was possible to come up with a set of rules, they said, but the level of detail that would be needed "means it would not be user friendly to apply in practice".
There were also problems with data protection law, which has changed significantly since this process started; the panel concluded that they "could not be confident in delivering an authoritative draft code" under the new rules.
After considering their report, Mr Swinney conceded defeat. He decided to withdraw the stalled information-sharing bill, and repeal the named person parts of the original act.
He told MSPs: "The mandatory named person scheme for every child, underpinned by law, will now not happen."
So what happens now?
The nationwide named person scheme might have been scrapped, but that does not mean the principle is entirely gone.
The policy had already been rolled out in one form or another in quite a few parts of Scotland, including the Highlands, Edinburgh, Fife, Angus and a range of other places. These do not take a uniform approach, and exist in a range of different forms which would have been brought into line and formalised by the nationwide scheme.
Mr Swinney confirmed that these "voluntary" programmes would continue, underpinned by existing data protection and information-sharing laws instead of the planned new ones.
However, he stressed that these only take place "where councils and health boards wish to provide them, and parents wish to use them".
The education secretary said scrapping the nationwide scheme "clears the way for services that are already helping so many children to continue without the controversy of recent years".
Opposition parties say the government has performed a "humiliating u-turn" on the policy - but Mr Swinney insists that ministers "continue to be fully committed to getting it right for every child".