Sophie Shotton, prosecuting, said Collard’s messages had made the girl’s behaviour “deteriorate” and the youngster became worried he would turn up at her school or home.

The child’s school also raised concerns about a change in her behaviour.

The Shadow Hunters filmed the moment they caught Collard and he was then arrested.

He pleaded guilty to attempting to incite a child to engage in sexual activity in June.

Ms Shotton told the court unemployed Collard has 32 previous convictions for 42 offences.

He began offending in 2009, and in 2016 was sentenced to a community order for sending sexually explicit messages.

Beverley Cherrill, defending, said Collard has learning difficulties and suffers from an attachment disorder developed from being separated from his parents aged two.

She said he never had the intention of actually carrying out the acts he said he was going to, but that he was “being as extreme as possible for sexual kicks”.

Ms Cherrill said Collard has been sectioned in the past and he falls just short of having Asperger’s. Collard claimed not to remember sending any of the messages and said he would “probably have been drunk” when he did.

Ms Cherrill said he is a heavy drinker due to his troubled life.

Collard was living at an address in George William Mews, Portslade, at the time of the crime.

Judge Christine Laing QC handed him a two-year sentence and said she considers his offences to be “of grave concern”, adding: “You knew full well what you were doing, even if you were to deny it in interview.”

Collard will be a registered sex offender for the next ten years and a sexual harm prevention order was imposed on him, severely restricting his access to children and computers.