A sick child abuser was found with more than 725,000 indecent images when police searched his home in Fife.
Roderick Riley, 62, was investigated after it emerged he had exposed himself to a youngster.
Officers who raided his home found indecent images featuring the child, which the court heard had been taken without their knowledge.
75,000 images were ‘category A’
Riley, of Queens Haugh in Carnock, was also found in possession of hundreds of thousands of child abuse images, 75,000 of which were classed as category A and of the most depraved nature.
In total he had 545,953 images which were described as “accessible”.
A further 180,011 “inaccessible” files, which were not readily viewable, were detected by cyber specialists.
He also had more than 3,000 category A videos on various devices.
There were more than 96,000 category B images in his collection and more than 1,000 category B videos, in addition to more than 550,000 category C images and more than 800 category C videos.
Appearing at Kirkcaldy Sheriff Court, Riley admitted using lewd and libidinous behaviour towards a child on various occasions between March 22, 2003 and November 21, 2004.
He also admitted repeatedly exposing his penis and masturbating in the child’s presence, recording footage of this happening and recording indecent images.
He admitted making indecent images of children and of possessing indecent images of children between May 3, 2009, and November 18, 2019.
Riley had 15 devices capable of storing images
Procurator fiscal depute Ronnie Hay told the court that when officers searched Riley’s home in November 2019, he told them “I’ve got everything”.
The depute said Riley told police he had been sexually abused by a couple who had taken pictures of him.
“It became something of an obsession to find these images online,” said Mr Hay.
“During this search a large quantity of computing equipment and storage devices were recovered.
“These were later found to contain indecent images of children.”
In total, officers found Riley had 15 devices on which images could be stored, including 10 hard drives.
Solicitor Gordon Martin said of his client: “He himself seems to have been victim to quite extreme sex abuse.
“He effectively collected hundreds of thousands of images.”
Mr Martin added: “His house wouldn’t pass the how clean is your house test.
“He is someone who hoards items of all sorts, including his hard drives and other devices.”
Sheriff James Williamson called for a restriction of liberty order assessment and deferred sentence until February 26.
Riley was added to the sex offenders register.