A teenage rapist who sexually assaulted a 13-year-old girl he contacted on social media app Snapchat has been detained.

The 17-year-old, who cannot be named for legal reasons, previously pleaded guilty to a charge under the Sexual Offences (Scotland) Act.

On Thursday, Dundee Sheriff Court heard the accused was also convicted of rape at the High Court last year for an offence he committed when he was 14 and his victim was 12.

He had received a community payback order (CPO) for the first offence but pleas for an alternative to custody were rejected by Sheriff Alastair Carmichael.

At a previous hearing, the court was told the accused had originally met the girl through a mutual friend in 2015 before he contacted her this year.

He contacted her on social media platform Snapchat before they met in Dundee on June 7.

They chatted before having sex in an area outside the Dundee and Angus College campus in Gardyne Road.

The 17-year-old then got up and said he had to leave. His victim alerted her mother later.

Defence solicitor Katrina Clark said: "He's aware he faces more time in custody.

"The more effective way forward for him would be through the intensive project outlined for him in the social work reports.

"That wouldn't be an easy option. This could be dealt with by a non-custodial sentence due to his age, the period he has spent in custody on remand and his acceptance of his guilt at an early stage."

Sheriff Carmichael imposed a one-year sentence of detention on the teenager, placed him on the sex offenders register for ten years and imposed a sexual offences prevention order for six years during which he will be monitored by specialist police.

He told the accused: "Unfortunately from your perspective no other method than custody is appropriate.

"I've come to that decision based on the gravity of the offence and also because you were subject to a CPO with specialist elements which you don't appear to have learned from."