A Dunfermline man sent an indecent image to someone he thought was a young girl.

However, the recipient of Ernest Nicholson’s photograph was, in fact, an undercover police officer.

Nicholson, 58, of Berry Law Place, appeared at Dunfermline Sheriff Court.

He admitted that between January 9 and 16 last year, he sent an image of a naked penis via social media to someone he thought was a child but was, in fact, an undercover police officer, and thus attempted to cause a child to view a sexual image.

He also sent sexual written communications to someone he thought was a child and thereby attempted to communicate indecently with a child.

Sentencing was deferred until March 14 for reports. He was put on the sex offenders register.