A sex abuse victim helped snare his rapist by saving damning messages on his phone.
The 15-year-old took screenshots after being repeatedly preyed upon by Craig Oxenham.
He later showed them to police.
The accused was aged between 15 and 16 when he committed the offences.
Oxenham, 18, escaped a custodial sentence when he appeared at Glasgow High Court on Tuesday after admitting rape and another sex offence.
Judge Lady Stacey instead ordered him to carry out 300 hours of community sentence and placed him on the sex offenders’ register for three years.
She warned him he would be brought back to court if he fails to comply.
The court heard the offences took place at a golf club and a cemetery in Kinghorn between September 2017 and June 2018.
Given your young age it is not necessary to send you to custody.”
Judge Lady Stacey.
Prosecutor Shanti Maguire said the victim had made it clear he did not want to do what Oxenham asked.
“As the number of incidents grew, he became embarrassed and scared at the situation he found himself in,” she said.
Oxenham, of Pettycur Bay, Kinghorn, made further demands of the boy on social media and threatened him.
The distressed victim eventually told a relative what had gone on.
“The boy took screenshots (of contact with Oxenham) which he later produced to the police,” said Miss Maguire.
He told officers he felt forced by Oxenham and there had been no option but to do what he asked.
Solicitor advocate Gordon Martin, representing Oxenham, said: “He was 15 and 16 when the offending started.
“He would struggle in a custodial environment.
“He accepts what he did was wrong.”
‘Very serious charges’
Lady Stacey told Oxenham: “I want you to understand you pled guilty to very serious charges.
“I am not going to send you to custody.
“Given your young age it is not necessary to send you to custody.”
She added: “I understand there are difficulties at present with community service because of the Covid situation so you have three years in which to complete the order.”