A north-east man sent sexual messages to a 10-year-old girl in a “classic example of grooming”.
John Lamb, from Fraserburgh, communicated with the youngster over a period spanning more than a month.
Between October 16, 2015 and December 4, 2015 the 57-year-old sent messages to the girl.
The offence came to light after the communications were seen by the child’s mother.
Yesterday Lamb, of Fernie Place, appeared at Elgin Sheriff Court to be sentenced after being found guilty at a trial.
Despite the court’s verdict, defence solicitor Robert Cruickshank stressed that his client continued to maintain his innocence.
But it emerged that the Aberdeenshire resident had committed a similar offence 34 years ago.
Mr Cruickshank said: “Clearly, he was a much younger man then.”
He added: “He is someone who would be considered vulnerable in a prison environment and is in need of medication.
“He is suitable for the Moving Forward Making Changes programme, which is suitable for the protection of the public.”
Lamb sent the messages from an address in Buckie.
Fiscal Robert Weir asked for monitoring of him due to him being considered “high risk”.
The Fraserburgh resident was found guilty of intentionally sending written messages of a sexual nature to a 10-year-old girl by social media.
Sheriff Olga Pasportnikov said: “I recognise you continue to deny the offence.
“However, I told you at the time of the trial that I consider this to be a classic example of grooming.”
Lamb was sentenced to 200 hours of unpaid work, was placed on the sex offender’s register for three years and had a curfew put in place for four months.