A legal challenge against the Scottish Government's plans to appoint named guardians for every child has begun at the Court of Session in Edinburgh.

The measure is contained in the Children and Young People (Scotland) Act and assigns a ''named person'', such as a teacher or health visitor, to look out for the welfare of every child under 18.

It is opposed by the No To Named Persons (NO2NP) campaign group, which argues that ministers have exceeded their powers and breached data protection laws and the human rights of parents.

Legal papers formally challenging the plans were lodged earlier this year and a judicial review before Lord Pentland began today.

Aidan O'Neill QC, who is representing the campaigners, said the case was a matter of compatibility with EU law and the fundamental rights of parents and children.

He said: "I make clear from the outset, none of the pursuers take issue with the idea that child welfare is of paramount concern in any of these issues."

He said there were three main issues to discuss - consent, and the fact that the legislation does not allow for consent or parental opt-out, necessity and the argument over whether it is necessary for every child to be appointed a named person, and the issue of child protection.

"The pursuers accept the need for child protection measures but this legislation is not about child protection," he said.

He said the legislation was instead about "a much more amorphous" measure of wellbeing.

Mr O'Neill said: "If you look at the named person provision focused on children at risk of serious harm, it would be difficult to object to that, but that is not what this is.

"This is focused on every child's wellbeing and there is a terrible tendency to slip between these two terms."

He argued that this reflected the "confusion at the centre of this legislation".

The legal action is being spearheaded by the Christian Institute (CI), the Christian charity CARE (Christian Action Research and Education), the Family Education Trust and Tymes (The Young ME Sufferers) Trust with the support of academics and individual parents. Donations to fund the case have been made from more than 70 different sources.

The Children and Young People (Scotland) Act received Royal Assent in March.

A Scottish Government spokeswoman said: ''The legislation, including the named person service, was supported by a large majority of those who responded to the public consultation, backed by a wide range of children's charities and professionals working daily to support families across the country, and endorsed by the parliament.

''As the legislation is currently the subject of a challenge in court, it would not be appropriate to comment further.''

The judicial review is expected to take place over four days.