A bricklayer who had more than 400,000 images of "unimaginable evil and depravity" on his computer has been warned he faces a lengthy jail term.
Sheriff Norrie Stein told 37-year-old Steven Perrie that he faced prison after 403,000 indecent images of children and 16,000 video clips were found at his home in Forfar, Angus.
Police who had to sift through the images described it as the worst material they had ever seen.
At Forfar Sheriff Court, Perrie pled guilty to the offences.
One of the most appalling images showed the non-medical circumcision of a boy estimated at six to seven years old.
Sheriff Stein said: "The court has heard lengthy descriptions of 420,000 videos and images of unimaginable evil and depravity.
"The only likely outcome is a very lengthy term of imprisonment."
Perrie, who is divorced, admitted that between 1 May, 1999, and 4 December last year, at houses in Forfar and Letham, he made indecent photographs or pseudo-photographs of children.
The Crown accepted his plea of not guilty to a charge of having indecent images in his possession at the Letham address on 4 December, with a view to show them to others.
Sentence was deferred until next month for the preparation of full reports. Perrie was remanded in custody.
Perrie's name was uncovered by FBI officers investigating a Texas company called Landslide Productions during the world-wide child porn crackdown.
Depute fiscal Brian Bell told the court that Landslide Productions acted as brokers for webmasters in Russia and Indonesia that provided child porn pictures.
Tayside Police officers had to sift through the material found on Perrie's computer in eight-hour shifts.
Mr Bell said: "Having spoken to both officers involved in researching this case, they are of the view this is the worst material they have ever seen.
Sheriff Stein paid tribute to the investigating officers "for having to carry out such a horrific duty."