Human rights guidance on restraint and seclusion in schools is to be published in a bid to protect some of Scotland's most vulnerable children.

The guidance, which will be produced by the Scottish Government, will direct local authorities, schools and staff in the lawful use of restraint and seclusion.

It follows action taken by the Equality and Human Rights Commission Scotland (EHRC) and the Children and Young People's Commissioner Scotland (CYPCS).

An investigation by CYPCS last year found the use of restraint and seclusion on pupils across Scotland is largely unmonitored, with glaring inconsistencies across local authorities.

Following discussions between the groups and Education Secretary John Swinney, the Scottish Government has said it will seek to involve children in the drafting and review of the guidance, as well as consider statutory action should the guidance prove to be ineffective.

It has said it will also develop and introduce a standard data set to be implemented across Scotland to ensure consistent recording and monitoring of incidents.

Lynn Welsh, head of legal at EHRC, said: "School ought to be a place of sanctuary and safety for all children.

"All staff must have clear and robust guidance to underpin their practice and ensure that children are supported to reach their full potential, regardless of background, health and ability, while having their human rights upheld and respected.

"Across Scotland, guidance and policies on the use of restraint and seclusion in schools have been inconsistent at best and totally inadequate at their worst." She added: "As the regulator of the Equality Act, we are pleased to have worked closely with the Children's Commissioner to use our unique legal powers to achieve this change.

"No child should experience inhumane or degrading treatment at school or later in life.

"Our schools play an essential role in shaping the attitudes of the future and enabling children to fulfil their potential.

"We welcome the Deputy First Minister's commitment to ensure that national guidance governing restraint and seclusion is produced that is rooted in the values of human rights and co-produced by children and their families.

"We hope this guidance will protect children from disproportionate use of restraint and the negative impacts which this can have on children and young people.

"We will continue to monitor progress on this area."

Nick Hobbs, head of advice and investigation at CYPCS, said: "The use of restraint and seclusion is a human rights issue.

"Our investigation revealed that a lack of national guidance was leaving children in school at risk of human rights violations.

"We were pleased to be able to work with the EHRC Scotland using our complementary legal powers to hold the Scottish Government accountable to its human rights obligations to children.

He added: "We are pleased that the Deputy First Minister has committed to implement our recommendation to produce human rights-based national guidance on restraint and seclusion and that children and families will be involved in the drafting and review of this guidance.

"It is particularly important that the Government will consider putting the guidance on a statutory footing if the evidence shows it is necessary.

"Clear and robust guidance will support staff and ensure that fewer children will be subjected to physical intervention in school."