A computer expert with a "fetish" for watching children being beaten was jailed for 32 months after downloading thousands of indecent images.
Police found nearly 15,000 indecent photographs and video clips on Andrew Paterson's computer.
His lawyer told Airdrie Sheriff Court his client had developed a fixation with corporal punishment as a child.
Paterson, 39, of Cumbernauld, North Lanarkshire, collapsed in the dock when sentence was passed.
The court heard 150 of the images were at the most serious end of the spectrum.
He had downloaded them from pornography websites and stored them over an eight-year period.
His lawyer, Colin Dunipace, said Paterson was ashamed of his conduct and had lost his job.
He said: "He has had a fetish and fixation of young girls in uniforms, particularly school uniforms as well as them suffering corporal punishment.
"It has been something which has been with him since he himself was a schoolboy and has never left him. The small number of the more serious pictures reflect this fetish and interest."
He said Paterson had never tried to distribute the images or make contact with children, and there was no evidence his obsession had progressed any further.
But Sheriff Petra Collins told him the gravity of his offences meant he must face a custodial sentence.
Paterson was given a two-year extended sentence, meaning he will be supervised on his release, and his name was added to the sex offenders registers.
HAVE YOU BEEN|
TO THE NEWSROOM?