A student has been found guilty of raping a schoolgirl in his halls of residence.

Brendan Orr attacked the teenager in his room at the Heriot Watt University's Riccarton campus in Edinburgh.

Orr, then an 18-year-old engineering student, later sent a message on social media to the victim in which he said he tied her up and raped her "to get revenge" for her stealing his "legal highs".

He also told the 16-year-old he hated her for what she had done, the High Court in Edinburgh heard.

Orr, 21, of Dunkeld Road in Aberfeldy, Perthshire, denied carrying out a sex attack on the girl but was found guilty of raping her and blindfolding her during the assault on November 4 in 2013.

The girl told the court she had asked Orr to buy her "legal highs", adding: "He was 18. I was only 16. He didn't really like it. I was using quite a dangerous amount. They helped me to cope.

"I feel like they worked in his favour in that it did make me more willing to do what he wanted to do."

She said Orr had accused her in a text message of taking some of his "legal highs" and she denied it. She told the court that she had in fact taken the substances, worth about £5, when he was sleeping.

The girl later told him the truth in a Facebook message and apologised.

She said: "After I sent the apology I expected him to hate my guts and never want to see me again."

In further messages he told her she disgusted him but he missed her and she was going to make it up to him "by money and stuff".

She told the court: "I thought that sounded dodgy but I just dismissed it at the time. I just kind of wanted to give him the money back and call it quits."

The girl said when she went to the university halls of residence she was "really, really nervous".

She said: "I had a gut feeling something was wrong. I felt like that from the moment I walked in his dorm room and he closed the door."

The court heard Orr had performed a violent sex act on her .

Advocate depute Jane Farquharson told the court the "legal highs" were perhaps the hold he had over her.

Lady Scott deferred sentence in the first offender for the preparation of a background report and allowed him to remain on bail.

The trial judge told him: "A prison sentence in an offence of this kind is almost inevitable. You need to prepare yourself for that."

Orr was placed on the sex offenders register.