A teenager raped a 12-year-old girl he met on the Snapchat social network.

The 17-year-old, who cannot be named because of his age, admitted rape when he appeared at the High Court in Glasgow on Wednesday.

When first interviewed by police, he denied everything.

Prosecutor Bernard Ablett told the court: "The complainer is a schoolgirl and was 12 at the time of the offences.

"They became known to one another through a mutual acquaintance via Snapchat social media.

"As a result, over the following days, they communicated to one another, with some of the messages being of a sexual nature."

In one text message, the teenager referred to his sister getting to know the girl's age. He texted: 'My sister will know how old u are too haha xxx.'"

They met up and had sex at the 17-year-old's home in Aberdeenshire on June 18 and 19, 2016.

When his mother asked how old the girl was, he told her she was 14 and said they were just friends.

However, her parents eventually found out and the police were contacted.

The 17-year-old first denied knowing the girl. But Mr Ablett added: "He then advised the police that he thought she was 12 years old and further stated that he knew that 'the legal age for having sex' was 16."

Judge Lord Burns deferred sentence until next month for reports and placed the 17-year-old on the sex offenders register.