An NHS worker had more than 8,000 child porn images.
Scott Wallace, 33, of Symers Street, Dundee, also had more than 10 hours of child porn videos.
Dundee Sheriff Court heard that at the time of the offence Wallace was working as an assistant technical officer with NHS Tayside, delivering medication to wards including those treating children.
Fiscal depute Vicki Bell told the court the images and videos were seized during a search of Wallace’s home address.
She said almost a million pornographic images were found most of them adult but that more than 8,000 were indecent images of children and more than 63,000 were “concerning” images of children but not illegal.
The fiscal said: “On a hard drive there were 5,861 indecent images of children and 2,720 on another computer.
“That was from a total of 370,000 mostly adult pornographic images on the hard drive and 574,000 on the computer.
“The age range was from newborn to 14 years old.”
Solicitor Nicola Brown said Wallace had lost his job as a result of the offence. Wallace admitted that between December 6 2009, and July 27 2014, at his home address he took or permitted to be taken or made indecent photographs or pseudo photographs of children.
Sheriff George Way said: “These are extremely disturbing admissions.
“He may not be employed where he was but taking into account the employment he had, until I’m satisfied he’s not a danger and he can be robustly dealt with in the community, I’m not going to allow bail.”
Sentence was deferred until July 7 for reports.
Wallace was remanded in custody meantime.