Mental health support for young offenders must be improved, MSPs have said, calling for faster assessments, more-flexible incarceration and different funding.

Holyrood's Justice Committee has warned of more "tragic consequences" for some people sent to young offenders' institutions (YOIs) or in secure care because of the current mental health support currently available.

The inquiry into mental health services and secure care places for children and young people in Scotland was launched following the suicides of Katie Allan and William Lindsay - also known as William Brown - inside HMP YOI Polmont.

Children or young people convicted and sentenced to detention are either sent to YOIs or - usually when under the age of 16 - held in secure care facilities.

During their inquiry, MSPs were told by the Centre for Youth and Criminal Justice about the significant levels of mental ill-health to be found within secure care in Scotland, with their survey indicating 35% of children had attempted suicide in the year prior to admission and 53% having suicidal thoughts.

However, just 36% of children within secure care had received support from the NHS's Child and Adolescent Mental Health Service (CAMHS).

The Committee is now calling for assessments of a young person's needs to be made within the first days of their incarceration, and consistent, high-quality physical, educational and mental health support to be provided afterwards.

They warned that there is a "postcode lottery" in Scotland for the standards of mental health support available, particularly in secure care units outside of Glasgow.

Committee convener, Margaret Mitchell MSP, said: "We know that many young offenders and people in secure care have themselves had traumatic childhoods, and have lived through adverse childhood experiences.

'We take the mental wellbeing of people in prison and secure care very seriously and while the numbers of suicides by young people in custody are small, any suicide in custody is a tragedy that has a profound effect on family and friends, as well as prison staff.'

The Scottish Government.

"Every effort must be made to ensure that these often vulnerable young people, who are in the care of the state, are in a safe environment, where they are provided with, and take, opportunities to rehabilitate.

"Sadly we are currently not achieving this in all cases, sometimes with the most tragic consequences.

"In particular, there is a pressing need for better mental health support, and improved contacts with family and friends. This would help young people to reintegrate, as well as to reduce the social isolation faced by young people on the inside."

There was also a call for more flexibility to allow a young person to remain in a secure care unit beyond their 18th birthday, if this was found to be in their best interests.

At present, people held in secure care units must move to HMP YOI Polmont on turning 18 - even if they only have a short time left to serve.

A Scottish Government spokesman said: "We take the mental wellbeing of people in prison and secure care very seriously and while the numbers of suicides by young people in custody are small, any suicide in custody is a tragedy that has a profound effect on family and friends, as well as prison staff.

"The Independent Expert Review of Provision of Mental Health Services at HMP YOI Polmont reported earlier this year and work with partners to address its recommendations is well under way.

"Good quality secure care helps improve outcomes for children and vulnerable young people with highly complex needs to re-engage and move forward positively in their community. We continue to work with COSLA and key partners to consider the future of secure care.

"We welcome the committee's report, which notes a significant drop in the number of children in custody since 2008, and will carefully consider its recommendations, always acting in the best interests of the child."