A FORMER soldier found guilty of grooming a female for sex that he thought was aged 14 has avoided prison.

Gordon Mair has instead been ordered to complete the maximum number of hours of unpaid work, 300, as a direct alternative to jail and placed on the Sex Offenders Register for five years.

A clinical psychologist, a psychiatrist and a social worker were in agreement that Mair, 38, required treatment for mental health issues and recommended a non-custodial sentence.

Mair was stung by so-called 'paedophile hunters' after he went to Wemyss Bay Station to meet what he believed was an underage girl.

Sheriff Neil Kinnear told the sex offender: "I am prepared to go with their recommendations and impose a community payback order."

As well as the unpaid work order, Mair will be kept under supervision for three years and denied access to any device capable of accessing the internet, unless approved by a supervising officer.

Restrictions will also be in place around any use of the internet by him and he is forbidden from deleting search history on any device he is allowed to use.

Mair is prevented from approaching or contacting any child aged 17 or under.

He will also undergo a mental health treatment programme, which Sheriff Kinnear said 'will be to his own benefit as well as being a benefit to society'.

Mair must also take part in a rehabilitation programme called 'Moving Forward, Making Changes'.

A jury at Greenock Sheriff Court in August took less than an hour to convict Mair of sending electronic messages to the 'schoolgirl' for the purpose of obtaining sexual gratification.

Mair, 38, turned up for a meeting with the 'girl' with a bag containing condoms, a sex toy and lubricant — following seven weeks of grooming her online.

But instead of having a rendezvous with an underage teenager — whom he'd arranged to take to his flat — he was confronted by a posse of people from vigilante group Maximum Exposure at the station.

Sheriff Kinnear told Mair: "The court has been provided with a lot of material about you.

"There is a detailed report by an experienced clinical psychologist, a psychiatric report and one from a social worker.

"All are agreed in what your difficulties are and how to address those, as well as there having to be an element of punishment too.

Maximum Exposure gathered more than 600 pages of chat log on Mair, the court was told.

He also sent photos of sex toys and satin dressing gowns to the 'child' and told her he would 'teach' her sex after making her his girlfriend.

In his messages to the decoy he said, 'I bet you have a rocking body', 'We will both be in satin, nothing else' and, 'You will fall in love with me'.

The jury of nine men and six women took 59 minutes to find Mair guilty of having indecent online communications for sexual gratification or causing humiliation, distress or alarm to a person he thought was aged between 13 and 16.

He committed the offence between May and July in 2019.