New sex education advice for Scottish schools
Revised guidance has been issued on how schools teach about relationships, sexual health and parenthood.
The most significant change since the last guidance was published 14 years ago is the introduction of civil partnerships and same-sex marriages.
Schools and local authorities are responsible for deciding just how to put the guidelines into practice.
Parents still have the right to withdraw their children from sex education lessons.
They have the right to withdraw their child if "alternative positive educational provision" can be provided.
The distinct ethos of Catholic schools is still recognised by the new guidelines.
The guidance provide a framework for how schools cover issues such as relationships, sexual health and protecting children from exploitation.
They reflect other pieces of guidance and legislation and other changes in schools in recent years.
The guidelines also highlight the need to protect children from homophobic and transgender bullying - an issue which continues to cause concern.
Lessons on relationship, sexual health and parenthood are expected to reflect issues relating to lesbian, gay, bisexual, transgender and intersex young people such as same-sex marriage and hate-crime reporting.
The document stresses that teachers should base their lessons on fact and should not support or endorse one type of relationship over another. This means, for example that they can neither condemn nor promote unmarried couples or same-sex relationships.
But the guidelines also make the point that if a teacher is asked to teach something to which they fundamentally object, they should feel comfortable raising this with the school or local authority.
The guidance warns that "there has been a rise in self-generated pornography among teenagers, including through sexting".
It also says teachers must "recognise that relationships for children and young people can begin and take place online" but they must balance this with "concerns about online grooming and child sexual exploitation".
The guidance says that a "comprehensive provision of information in an open and transparent environment by teachers who are well-trained and feel confident to deliver high-quality lessons will ensure that children avoid seeking inappropriate alternative methods to gather information about sexual health and relationships, such as pornography.
Curriculum for Excellence
Learning Minister Alasdair Allan said: "The fundamental purpose of Relationships, Sexual Health and Parenthood (RSHP) education is to teach children and young people to have respect for themselves and others.
"This refresh of the guidance reflects the societal changes that have taken place since the old version was published, changes in laws and the successful introduction of Curriculum for Excellence.
"Our engagement on the guidance, which began last year, generated debate and attracted a number of responses and I am grateful to all who contributed.
"The issues covered by RSHP can be seen as the building blocks to how pupils look after themselves and engage with people for the rest of their lives.
"These classes allow pupils to think about their development and the importance of healthy living surrounded by their peers who will have similar experiences to them.
"The guidance recognises the professionalism of teachers, the expertise they bring to making lessons age-appropriate and an invaluable addition to discussions that parents are likely already having with their children at home."
The guidelines also explore the role "peer educators" can play - in other words, how specially-trained young people can provide information to others at their school.
An award-winning project at Kirkcaldy High School - where NHS services are provided within the school and where young people are trained to provide information - has been credited with helping to reduce the number of underage pregnancies locally.
Tam Baillie, Scotland's Commissioner for Children and Young People, said: "This guidance puts into practice the commitment made in the Children and Young People (Scotland) Act 2014, that the government would actively promote the rights and wellbeing of children and young people.
"Recent high-profile cases of Child Sexual Exploitation and sexual abuse have highlighted the importance of ensuring that education in schools equips children and young people with information to help keep themselves safe.
"Giving children and young people the knowledge and understanding of healthy, respectful and loving relationships and the opportunity to explore issues in a safe environment protects them from harm and promotes tolerance.
"Young people have a right to get comprehensive, accurate and evidence-based information to help them to make positive, healthy and responsible choices in their relationships.
"Furthermore, there is extensive evidence that high-quality RSHP education helps reduce teenage pregnancy; delays the onset of sexual activity and increases the likelihood of young people using contraception when they do start sexual relationships.
"The implementation of this guidance in all schools across Scotland will be a positive step in keeping our children and young people safe."
Martin Crewe, director of Barnardo's Scotland, said: "We think it delivers a much clearer link between the child protection system and the advice given to teachers on this important subject.
"We feel particularly pleased to see the inclusion of information about the steps that need to be taken to address the dangers of child sexual exploitation.
"We hope the guidance will be an important step in ensuring all Scotland's children are supported and protected through high-quality evidence-based relationships, sexual health and parenthood education."