A man who tried to arrange to meet a 13-year-old girl for sex after grooming her online has been spared jail.

Nicholas Rawlings sent the ‘child’, who in reality was a police officer, pictures of his genitals after chatting on social media.

And when the 28-year-old was arrested it was found he had done it before, even travelling to York to try and meet a 16-year-old child he had been chatting with.

But after hearing his offending was ‘an opportunity’ to ‘prevent urges becoming actions’, a judge at Swindon Crown Court imposed a suspended sentence.

Colin Meeke, prosecuting, said the officer was using messaging service Kik while posing as a 13-year-old girl called Chloe.

Within about an hour of being contacted by Rawlings he said the conversation turned to sex.

During the chat he also sent her explicit pictures of himself.

“He tried to make arrangements to meet her to have sexual relations,” he said.

“He said not to worry that he would buy condoms. So the information was passed to local police officers here in Wiltshire.”

Following his arrest he said his hardware was seized and it was discovered it was not the first time he had tried to contact children.

“Evidence on his computer reveals he had been in contact with at least two other children aged about 14,” he said.

“They seemed to have turned down quite quickly his attempts at sexualised conversation with them.”

And he said he also arranged to meet a 16-year-old, who had a 15-year-old friend, in York but that fell through when there was talk of payment for sex.

When he was questioned he prevaricated and minimised, Mr Meeke said, but the police evidence ‘boxed him in’

Rawlings, of Hallam Moor, Liden, pleaded guilty to attempting to meet a child after sexual grooming.

Alec Small, defending, said his client was a naive man whose relationship, which ended soon after, was on the way out.

“What we have got from his attempt, by the police doing their job properly and catching someone before they can do more and stop them, we have the opportunity to prevent urges becoming actions.”

He said that he was supported in court by his partner, employer and two friends who all know about what he has done.

Passing sentence Judge Ian Lawrie QC said “There are people on hand to ensure that you don’t deviate from the sentence, to ensure that you never ever make such contact with children under the age of 16 again.”

He imposed a 18-month jail term suspended for two years with a sex offenders' programme and six-month curfew. Rawlings will also have to abide by a sexual harm prevention order and register as a sex offender for 10 years.