The Scottish Government has been ordered to pay the legal bill of campaigners who opposed its named-person scheme.
The UK Supreme Court has ruled that the SNP administration must meet the legal costs of the No to Named Persons (NO2NP) campaign group, estimated at more than £250,000.
NO2NP said the cost to the taxpayer of the court action could hit £500,000 once the government's own legal bills are taken into account.
Campaign spokesman Simon Calvert said the decision was a "total and utter vindication" of the legal challenge.
He said: "The Scottish Government argued we should pay our own costs but the judges disagreed, awarding us our costs, further proving that we have been right all along.
"Had the judges agreed with the Government spin that they basically won the case and just had to make a few tweaks to the named person law, the court would not have awarded us our costs."
A Scottish Government spokesman said: "The policy aim of providing a Named Person service has been judged by the Supreme Court to be entirely legitimate. The Supreme Court's ruling requires changes to be made specifically to the information sharing provisions of the 2014 Act.
"The nature of the ruling means that it is likely that Scottish Ministers may incur costs at a level yet to be determined.
"Ministers remain absolutely committed to the named person service and the Deputy First Minister updated Parliament outlining how the government is working towards the implementation of the service.
"We will engage with key partners across public services, the third sector, Parliament and the wider public throughout the process as we make the necessary changes to the legislation."
Scottish Conservative education spokeswoman Liz Smith MSP said: "This is a very considerable sum of taxpayers' money which, I am sure the public will agree, would have been much better spent on the most important priority of raising attainment in our schools.
"The named person policy has been flawed from the beginning.
"The Supreme Court ruling earlier in the year made clear that the data sharing aspect of the policy was unlawful - something which undermines the Scottish Government's whole approach to this wrong-headed policy that nobody wants."
Ministers were forced to delay the roll-out of the controversial scheme after the Supreme Court ruled in July that some elements were "incompatible" with the right to privacy and family life, as set out in the European Convention on Human Rights (ECHR).
The policy, introduced as part of the Children and Young People Scotland Act of 2014, would appoint a single point of contact, such as a teacher or health visitor, to look out for the welfare of all children up to the age of 18.
Opponents argued the scheme is overly intrusive into family life and could lead to an increased workload for those tasked with administering it.