A sex offender who send lewd messages to what he believed was a '12-year-old girl' but who was actually an undercover cop has dodged jail.

John McWhirter, 61, returned to court for sentencing after pleading guilty to attempts to communicate with a child from his then address in Station Road, Drongan.

McWhirter admitted sending messages of a lewd, indecent and sexual nature to someone he thought was a girl aged 12 called ‘Emma’ but in fact an undercover police officer, on various occasions between May 8 and May 30, 2021.

He also admitted attempting to send the messages for ‘sexual gratification or of humiliating, distressing, or alarming’ them.

Sentence was deferred for a criminal justice social work and full risk assessment.

McWhirter was also told he will be subject to sex offender notification requirements and bail was continued.

When McWhirter, now of View field, Keith, returned to court on Friday, May 12, defence solicitor John Gallagher said the offence 'was quite frankly awful'.

He said: "Various reports were produced. He has shown insight, this is a matter where the plea was tendered at the first diet, and it's quite clear from my discussions there has never been any denial, and he pleaded guilty at an early stage in proceedings.

"Notwithstanding the seriousness of the offence, I would submit it is a favourable report. If my lady supports the recommendation for the Moving Forward Making Changes programme he would certainly submit himself.

He has made clear to me he will cooperate in any punitive elements to sentence.

There has been no difficulty observing the conduct requirements in terms of his bail order. He has thoroughly complied with bail conditions throughout and the [sex offender] notification requirements."

Sheriff Mhairi MacTaggart said: "Mr McWhirter the seriousness of this will not be lost on you. What occured here was appalling.

"I think you must know that a custody sentence could easily be justified. The one reason I'm stepping back is you require help and intensive work, and sending you to prison is not going to achieve that.

"The only way forward is to get help and to not offend again. I'm going to make you subject to a very intense programme Moving Forward Making changes. It is a long, intensive programme which will take three years to complete."

He was placed under supervision of the authorities on a community payback order for three years, including the Moving Forward Making Changes Programme.

He will also have to complete 180 hours of unpaid work and register as a sex offender for the three years.

He will also be allowed no unsupervised access to children under 16, forbidden from owning devices that can delete internet history, with any internet use monitored by police.