A SEX offender sent a series of disgusting messages to someone he thought was a 13-year-old schoolgirl — unaware he'd fallen into a police trap.

Mark McCaig used the social media platform Kik to unwittingly communicate with the undercover officer as evidence of his deviancy piled up against him.

During the month-long period that he was under covert investigation, McCaig, of Greenock's Branchton area, typed out texts that are too vile to publish.

He believed he was chatting with a girl called 'Kaitlin' who had turned 13 just three months prior to the conversation beginning.

But he was in fact messaging a female undercover online police officer attached to a specialist crime unit.

McCaig sat in the dock of Greenock Sheriff Court with his head in his hands as disturbing details of his crime were narrated.

He stated in one message, sent between April 1 and 30 last year: "I'm a 38-year-old who gets with schoolgirls — I'm a sad loser hun."

In another, McCaig, now 39, wrote: "I love underage girls that dress like little tarts."

He also told the 'girl': "I got a girlfriend at home and one who lives 20 miles away — the one that lives 20 miles away is 14."

McCaig added: "I so wanna be your first kiss...we can go a walk and people will think I'm your dad."

He also appeared eager to chat with more underage girls, asking: "So who you got on Kik then, any mates I can add?"

Prosecutor Claire Rowan told the court the investigation came about as a result of intelligence relating to a Kik user calling himself 'Chrisyboy80'.

Fiscal depute Ms Rowan said: "The undercover officer had provided her age to Mr McCaig as 13 at the outset of the chat and referenced her young age through the conversations.

"The accused initiated sexualised chat with the officer..."

The court heard how the investigation led police to an internet IP address linked to McCaig's Sky Broadband account at his home address.

Officers obtained two search warrants and swooped on the property at 8.40am on May 6 last year.

Ms Rowan said: "The accused was thereafter arrested and taken to Greenock police office to be interviewed.

"He declined access to a solicitor and during the course of the interview, he spoke freely throughout and admitted engaging with a person online who identified themselves as a 13-year-old female for sexual gratification.

"However, he stated that he believed the person he was communicating with was over 18 and this is part of fantasy role play known as 'age play', which he enjoys.

"He made no reply to caution and charge."

McCaig pleaded guilty on indictment to communicating with a female he believed to be 13 for the purposes of obtaining sexual gratification and requesting that she engage in sexual acts with him.

Sheriff Andrew McIntyre deferred sentence until February 5 for background and risk assessment reports.

Defence lawyer Aidan Gallagher has reserved his plea in mitigation on behalf of McCaig until then.