A man who admits to being "attracted to young children" sent sexual messages to what he thought were young girls on Facebook, a court has heard.
Benjamin Roberts talked about kissing and cuddling the girls, who he believed were aged 11 and 13, and sent one of them a picture of his genitals.
But the Facebook pages were actually being run by an adult woman who was a member of a group set up to catch online offending against children.
Swansea Crown Court heard how over the course of a number of weeks 30-year-old Roberts made contact with Facebook accounts seemingly belonging to young girls called Elle and Paisley.
Robin Rouch, prosecuting, said the contact with one "girl", who claimed to be 11, was fairly short-lived but during it the defendant told her how beautiful and sexy she was and told her how he wanted to kiss and cuddle her.
Contact with the second girl, who told Roberts she was 13, lasted for considerably longer.
The court heard the conversation from the defendant soon became explicit with Roberts talking about the girl's body, telling her he wanted to give her "hugs and kisses", and asking for pictures of her breasts. The defendant then sent the decoy account an explicit picture.
The prosecutor said in a later conversation Roberts told the girl he was in the bath pleasuring himself.
On June 7 members of the group travelled to the defendant's house in Swansea to confront him. The court heard he was out when they arrived but other members of his family were present and called the police.
Roberts, formerly of Robert Street, Manselton , Swansea but now of no fixed abode, pleaded guilty to two counts of attempted sexual communication with a child.
John Tarrant, for Roberts, said the defendant had been candid with probation about his "attraction to young children" and "inappropriate thoughts and fantasies". The advocate added that his client would welcome any treatment or help to "rid him of these thoughts".
Roberts was sentenced to 24 weeks in jail and was made the subject of a sexual harm prevention order for the next seven years. He will also be a registered sex offender for the same period.