Almost half of pupils have been subjected to or witnessed offensive behaviour at secondary school.

A Holyrood survey found 637 pupils (47.5%) said they had experienced or seen hate expressed towards people at school due to their religion, race, nationality, disability or sexuality.

Around two-thirds reported seeing the same behaviour online and more than a quarter (28.1%) said it had happened at a football match.

More than a fifth said it happened while heading to or leaving a game.

Pupils were also asked about threatening communications on social media.

Around a third (30.2%) said they or someone they know had been subject to a threat online to carry out a seriously violent act or a threat intended to stir up racial or religious hatred.

A total of 870 pupils, 60.9%, said neither they or anyone they know had been subject to such serious threats.

Holyrood's justice committee surveyed all of Scotland's 364 secondary schools in light of a member's bill aimed at repealing the controversial Offensive Behaviour at Football and Threatening Communications (Scotland) Act.

The two-part law is aimed at tackling both sectarianism at football - including offensive chants and songs - and cracking down on violent online abuse.

Around 50 schools responded to the committee's drive to gather views of young people on the repeal plans, with 1441 pupil responses in total.

Responses for and against the repeal slightly favour keeping the current legislation, with 44.6% backing having a law banning offensive songs at a football match and 41.3% against it.

The survey report concluded: "Many respondents said that the law should not apply to any other venues, whilst some thought it should apply to sporting events, and others that offensive songs should be banned everywhere."

The Scottish Government used its majority to introduce the law in 2012 but it has faced criticism from political opponents and legal figures.

Last year, it suffered a symbolic defeat when Tory, Labour, Liberal Democrat and Green MSPs backed a motion calling for its repeal.

Labour's James Kelly has since lodged a member's bill to repeal the law, claiming it has "broken down trust between fans and police", while supporters of the legislation claim it deters people from offensive behaviour.