A 52-YEAR-OLD sex offender was snared in a police operation in which he had online sex chats with a person he believed to be a 12-year-old girl.

In fact, Peter Houlihan’s depraved messages were being sent straight to a police officer, as part of a decoy operation run from England.

Houlihan, of Back o’ Yards, Inverkeithing, appeared in the dock at Dunfermline Sheriff Court.

He admitted that between December 8-11, he sent sexual communications via the WhatsApp and Fast Flirting platforms to a police officer then posing as a 12-year-old girl.

Depute fiscal Freya Anderson-Ward said East Midlands police had set up an operation where officers would pose as children online.

In this case, an officer was posting as a 12-year-old girl called ‘Sam’ on the Fast Flirting platform when Houlihan made contact.

They engaged in a conversation which they then moved on to WhatsApp.

At one point, Houlihan said to ‘Sam’: “You’re only a kid” but he then went to make the conversation sexual, asking repeatedly about her masturbating.

He asked: “Have you ever touched yourself when you talk to the big boys, do you like it?”

He continued asking 'Sam' about sexual matters over “a prolonged period”.

When arrested, he claimed he thought ‘Sam’ was 18.

However, defence solicitor Aime Allan said her client accepted that he was told the girl was only 12 and his comment to the police when arrested was made out of “panic”.

She went on: “He clearly accepts that having been told the person was a 12-year-old girl he should have ceased all conversation.”

She said her client lived alone, was on benefits and had “significant mental health problems”.

She added: “He can offer no explanation for his behaviour and accepts he made a huge mistake.”

Sheriff Alastair Brown deferred sentence for reports until April 29. Houlihan was put on the sex offenders' register.