A Scripture Union Scotland worker was caught with thousands of child abuse images and videos while he was employed at the Christian charity's Bible camp for youngsters.
Scott McVean was found with the images after he accidentally dropped a memory stick in the staff room at the Lendrick Muir centre near Kinross.
Colleagues plugged in the USB device to see who it belonged to and found it contained images of children as young as nine years old.
Police officers were called in by the religious charity and McVean was found to have more than 5000 pictures and videos of child abuse.
At Perth Sheriff Court on Thursday, McVean, from Carluke, admitted downloading indecent images over a five-year period between June 2006 and January 2012.
Fiscal depute Rebecca Kynaston said: "Scripture Union Scotland and Lendrick Muir is an activity and conference centre for children and young people. The accused was employed there at the time of the offences.
"A colleague of the accused found a USB memory stick lying on the floor of the staff room. He plugged it into the computer to establish its owner.
"On plugging it in he noticed small photographic icons on the screen. They appeared to be of naked females and some looked to be under the age of 16.
"The employee told a colleague what he had found and showed him the content of the memory stick. They were unsure what to do and began deleting the images.
"But then they thought this wasn't the best course of action and stopped deleting them. They took the memory stick and gave it to the director of Scripture Union.
"The director sent it to Scripture Union's IT support services. The memory stick was examined and the deleted material was recovered. They also found a document on it which was a letter in the name Scott McVean.
"Scripture Union held a meeting between the director, the IT support worker who examined the stick, and the accused. The accused admitted the memory stick belonged to him and that he was aware of its contents.
"The accused was suspended from his post at Scripture Union and the matter was reported to the police. Police examined it and found it contained adult pornographic images and indecent images and videos of children."
A warrant was granted and a raid was carried out on McVean's home in Carluke where a further haul of illegal images was found on his home computer.
In total, McVean admitted getting caught with 5389 images and 61 videos with a total running time of around an hour.
The court was told he had been in possession of the images from June 1, 2006 until January 20, 2012 and they showed girls aged between nine and 16.
Solicitor Archibald Hill, defending, said McVean had copied images from his home computer onto the memory stick to have with him at the Lendrick Muir centre.
Sheriff Michael Fletcher deferred sentence for reports until July.
People who read this story also read
- London lawyer called rail worker 'a Scottish a***hole' in drunken rant
- Elderly woman 'distressed' after teenager exposed himself in her home
- Elderly woman found dead after gas leak in Borders home named
- Family 'increasingly concerned' for man reported missing from home
- Disgraced Jimmy Savile's Highland cottage due to be sold at auction