A school IT manager has been jailed for two years at Swansea Crown Court after being caught with nearly 400,000 indecent images of children.
Jeffrey Gravell, 54, had stolen computers from Coedcae Comprehensive in Llanelli, and used them to download the pictures and videos at his home.
The images included more than 700 deemed to be in the most serious category of indecency.
However, investigators said they were certain that no pupils were involved.
Gravell, of Llanelli, was convicted of 43 counts of making and possessing indecent images following a trial in January.
He was also convicted of stealing thousands of pounds worth of computer equipment from his school.
Judge Christopher Vosper said: "This was an enormous number of indecent images, the most that Dyfed-Powys Police have ever encountered.
"By my calculation there were between 6-7,000 images at the worse levels - four and five.
"The downloading of images provides a market for these pictures and causes children to be harmed.
"This was a high breach of trust as you were the IT manager and were responsible for IT equipment and maintaining it."
The court heard that Gravell had collected so many indecent images that police officers stopped counting them once they reached 391,270 pictures.
Reputation 'in tatters'
Jim Davies, prosecuting, added: "He hoarded it rather like a magpie. He had a vast library of indecent images of children - over 300,000 images and movies were catalogued."
At his trial, Gravell claimed he had no knowledge of the pictures and claimed they must have been downloaded during routine maintenance of the school's technology networks.
He also claimed that the collection of computers uncovered at his home were being kept for repairing other school equipment, allowing him to work from home.
Robin Rouch, defending, said it was clear that Gravell's reputation was "now in tatters".
"His chances of employment after his release are highly unlikely," he added.
Gravell was jailed for a year for possessing the indecent images and a further year for the theft of the school computer equipment.
He was also ordered to register as a sex offender for 10 years and banned from working with children indefinitely.