Scotland's children's tsar has backed a schoolboy's campaign to end gender-specific school uniforms.

Luca Scarabello, 13, lodged a petition with the Scottish Government last November saying uniform codes can cause "serious distress" in gender-variant pupils, and cause stigma.

He argued that as girls are allowed to wear trousers, boys should be allowed to wear skirts to school. His petition is under consideration at Holyrood.

Tam Baillie, Scotland's commissioner for young people, said the issue "raises some important children's rights issues" and agreed rules on uniform could be harmful to some.

Pupils are not obliged by law to wear a uniform, and neither schools nor education authorities have powers to compel parents to send their children to school in a uniform.

But local authorities must have a dress-code policy and headteachers can also ban certain garments.

Mr Baillie said gender-specific uniforms, such as trousers for boys and skirts for girls, could cause "serious distress" for pupils with gender variants.

He also said schools ought to review uniform policies to make sure they do not discriminate.

Mr Baillie has written to the clerk of the Public Petitions Committee, which is considering the schoolboy's campaign. His letter said: "I believe we should be celebrating difference, rejecting discriminatory practice and allowing our children and young people to express themselves freely in a way that is both inclusive and respectful."

The commissioner believes forcing children to stick to strict uniform policies could contravene the UN convention on the Rights of the Child and the Equality Act 2010, with the law placing a duty on public bodies to prevent discrimination on the grounds of gender-reassignment or sexual orientation.

He also called for a debate on Luca's proposals for uniforms to be more comfortable, less physically restrictive and more affordable.

Mr Baillie said: "I agree with the petitioner that considerable time can be spent in enforcing compliance which has the potential to lead to resentment on the part of the pupil. This can distract from time which could be better spent in developing supportive learning environments.

"The suggestion of the petitioner to replace traditional uniforms with more comfortable and cheaper alternatives is one that is worth discussing, but I would prefer to call for flexibility rather than a blanket ban on school uniforms. This would accommodate difference and reduce stigma."

Education Secretary Michael Russell has previously said the issue is a matter for education authorities.

Luca is a Green Party supporter from Camelon near Falkirk, who attends St Mungo's RC High School and has previously petitioned to end faith schools.

His petition last year to MSP's claimed: "Gender-specific uniform codes should be ended because they discriminate against transgendered pupils and are, for the want of a better word, pointless. They have no real use and do not make anything more practical. These uniform codes can cause serious distress in gender-variant pupils."

At the time, Public Petitions Committee deputy convener Sandra White said many considered school uniforms worthwhile for safety and security.