A Cardigan man who sent a series of sexually explicit message to what he thought was a 14-year-old girl has avoided being sent to jail.

Gavin Carter, 45, of Felin Ban, appeared before Swansea Crown Court for sentencing after previously pleading guilty to attempting to engage in sexual communication with a child, attempting to incite a child to engage in sexual activity, and two counts of attempting to engage in sexual activity in the presence of a child.

The court heard he thought he was talking to a 14-year-old girl and sent videos of himself masturbating.

He was actually exchanging messages with a woman acting as part of a paedophile hunter group

The court was told that Carter messaged an account named ‘Lilly’ on a social media platform before swapping to having a conversation on WhatsApp.

Over a number of days in June, Carter sent a series of sexually explicit messages.

In July , the paedophile hunter group obtained his address and went to his house and alerted the police.

Carter was later arrested and charged.

A pre-sentence report into Carter painted a picture of the defendant as "a lonely, isolated individual" who became increasingly withdrawn following the death of his mother.

Passing sentence, Judge Paul Thomas KC said he had given the issue "a great deal of anxious consideration" before deciding the sentence could be suspended.

He told the defendant that "by the skin of your teeth" he had avoided immediate custody.

He was handed a 20 month prison sentenced, suspended for two years.

Carter was ordered to complete a six-month alcohol treatment programme, 150 hours of unpaid work and a rehabilitation programme.

Carter must register as a sex offender for 10 years and was made the subject of a sexual harm prevention order for the same period.