A man who downloaded more than 80,000 images of children being sexually abused claimed he did it to prevent him preying on youngsters.
Russell Kay, 48, stored the pictures and videos for over 20 years, much of it hidden away on disks he kept in the loft of his Chippenham family home.
But after hearing that the father had himself been abused as a child and used the material "in the way a heroin user takes methadone", a judge at Swindon Crown Court imposed a suspended sentence.
Kay pleaded guilty to three counts of making indecent images of children between July 1995 and 30 April last year, reported the Swindon Advertiser.
The jury heard that police received intelligence that kay's IP address had been used on a file-sharing website that posted these images.
Officers seized a laptop, three external hard drives and a box of CDs, which were full of child abuse images, from the loft at Kay's home.
Grace Flynn, prosecuting, said there were 271 items in the worst category of abuse, including 64 movies, 431 in the middle bracket of which 45 were films and 81,650 in the lowest level, including 155 movies.
She added when police questioned Kay he admitted collecting these images for over 20 years, but blamed a traumatic childhood.
Abused as a child
Peter Binder, defending, said Kay was abused as a young boy by a male friend of his parents, and used this material to avoid becoming a predator himself.
Binder said: "His understanding was: having been a victim himself, as in his view victims in his words are hard wired to become abusers. And so he feels he was looking at this material in the way a heroin user takes methadone.
"It was really the lesser of two evils as it reduced the risk of him committing a contact offence.
"He seems to be of the view that what he was doing was in a sense preventing the situation from getting worse. It is hard to fathom.
"Apart from this secret life of storing this material he has been in many ways a model citizen."
Binder added that following his arrest in April last year Kay had sought help for his problem and now had blocking software on his electronic devices.
The lawyer said that Kay had lost his job as a result of offending but his wife and daughters, who are aware of his past, are standing by him.
Judge Tim Mousley QC said: "Every time you looked at those images for your perverted gratification you were witnessing a young child or children being violently abused."
But the judge said as there is a chance Kay can be managed in the community, he would impose a suspended a 12-month jail term for two years.
The court added that Kay will also be under supervision for two years and must abide by a sexual harm prevention order. He will be registered as a sex offender for 10 years.