A PERVERT who pretended to be a teenager as he sent creepy messages to an undercover cop posing as a schoolgirl has been spared jail.

Grandfather William Barr, 61, claimed to be just 19 while having chats with what he thought was a 13-year-old girl.

But Barr, who has been married for 38 years, was actually messaging a male police officer, who cannot be identified.

The officer, who had set up an account to catch sex predators preying on youngsters, alerted colleagues after Barr hounded ‘her’ with dozens of messages saying he wanted to have sex.

And it was Barr’s wife who answered the door of the home they shared in Renfrew when officers arrived to arrest him over his actions.

Barr, who has since fled to Blackpool, admitted his guilt when he appeared in the dock at Paisley Sheriff Court in November.

Procurator fiscal depute David McDonald told the court the communications between Barr and the officer began in November 2018 after police set up an account on the KIK messaging app, claiming to be a 13-year-old girl from Oxford.

Barr initially said he was “way too old” before claiming to be 19.

He then said he would “love” to send her a pic of himself but couldn’t, adding: “I could get in trouble because of ages.”

Barr went on to say he wanted to ask the girl for a picture but was worried he’d “get into bother” if she did and it was discovered.

The court was told that his wife answered the door when officers went to detain him in March and, when cautioned and charged, he replied: “I’m bamboozled.”

Sentence was deferred for background reports and Barr returned to the dock last month to learn his fate.

Defence solicitor Rhona Lynch said Barr and his wife had moved to England because of abuse they both suffered after his actions came to light.

She added that he has two grown-up sons and that one of his children has now “disowned him.”

Ms Lynch said: “He accepts he has brought that entirely upon himself.”

She told the court that Barr, a first offender, had been working as a coach driver but had to give up the job due to a health problem and “began to feel very lonely,” so he went online to find company.

Ms Lynch added that, despite the fact he had been having sexual chats with what he thought was an underage girl, his wife was sticking by him.

Barr could have been jailed for up to five years for the offence but, after hearing that he was “deeply remorseful,” Sheriff Tom McCartney spared him prison.

Instead, he placed Barr on a Community Payback Order that will see him supervised by social workers for the next three years and having to carry out 240 hours of unpaid work in the next 12 months.

Barr was also placed on the Sex Offenders Register for three years and must attend a programme which helps sex offenders change their ways.

Sheriff McCartney told him: “Notwithstanding the gravity of this offence, I can deal with it by way of a sentence which is a direct alternative to a sentence of imprisonment.”

Read all the latest from Renfrewshire and beyond