A paedophile built up a collection of 50,000 child sex abuse images and videos over almost five years, a Swindon court heard.

But Judge Jason Taylor QC spared Andrew Moss an immediate spell behind bars, saying it was in the interests of children that the 52-year-old was rehabilitated.

Sentencing him the 16 months imprisonment suspended for two years, the judge said: “Offending of this sort is incredibly serious.

“These children in your images were real, just as real as those you’d see in the street and your offending, particularly such an entrenched pattern of offending, perpetuates the horror and misery these children undergo.

“If it wasn’t for people like you it wouldn’t be as widespread. You are a vital link in the chain.”

Prosecutor Rob Welling told Swindon Crown Court police had visited Moss at home last April after receiving intelligence that he had been downloading child sex abuse images online since 2016.

They seized two laptops, with analysts uncovering more than 50,000 indecent images and videos saved into folders across the devices.

Within hours of his home being raided on April 24, Moss had confessed to detectives about what he had done. He would later say he felt relieved to admit his crimes.

Police learned that he had been downloading indecent images since 2014, two years earlier than they had previously.

Specialists had categorised a small proportion of his collection.

He was charged – and admitted – possession of 1,863 category A images, which include depictions of child rape, 2,129 in category B and 4,431 in category C.

The children shown in the pictures and video included girls as young as three.

The court heard he did not sexualise children in everyday life as he had “compartmentalised what he saw online”.

He was deemed by the probation service to be a low to medium risk of reconviction.

Clare Fear, defending, said her client was well aware that the custody threshold had been passed and he was at risk of being sent to prison. He was keen to complete rehabilitation activities suggested by the probation service designed to reduce his risk to children in the future.

Moss, 52, of Beech Avenue, Pinehurst, admitted three counts of making indecent images of children.

Judge Taylor ordered Moss complete 16 rehabilitation activity days and 200 hours of unpaid work as part of his suspended sentence.

He was made subject to a 10-year sexual harm prevention order and must sign on to the sex offenders’ register for a decade.