A primary school caretaker who admitted possessing indecent images of children was secretly living in a store cupboard at the school where he worked.
Gavin Clark, 41, was jailed for 12 months and put on the sex offender's register for 10 years after he admitted possessing nearly 4,000 indecent images of children.
A court heard how Clark had secretly set up home in a store cupboard at Eaton Primary School in Norwich for several weeks last year following his divorce.
Clark had moved out of the hideaway after taking sick leave but contacted the school to request to pick up some "personal items" he had left there.
It was then the school's headteacher Steve Portas discovered the makeshift living arrangements in the cupboard, along with his laptop, memory stick and SD card which contained a total of 3,931 indecent images.
Norwich Crown Court heard how 491 of the images fell in the two most serious categories of abuse and many pictures showed pictures of children under 13. There is no evidence to suggest the images involve any children at the school
Clark admitted three counts of possession of indecent images, but denied looking for the images on the internet. He told police he had unwittingly transferred them on to his laptop after he had found the pictures on a discarded memory card away from the school premises.
Ian James, defending, said: "He was effectively living in a cupboard at the school where he worked. That fact explains the possession of the material at that particular location.
"It's the fact that he was living there, staying there, that is the relevant consideration, rather than anything more sinister."
Judge Mark Lucraft was satisfied Clark did not create or distribute the images and gave him credit for his guilty plea, but said the extremity of the images was an aggravating factor to his sentence.
He added: "It seems to me that the reasons for your behaviour are very difficult to discern."
The head of the school assured the court that Clark had been properly checked before he was offered the job of caretaker.
Portas said: "Safeguarding children is always our first priority. To hear that a former member of our staff has acted in this way is deeply upsetting and we are pleased that Clark has been brought to justice.
"Our school takes the safety and welfare of its pupils extremely seriously and deals with any allegations quickly and robustly.
"We acted as soon as these allegations came to light by referring the matter to the police and Norfolk County Council and have assisted them fully with their investigations.
"Clark who had undergone all the appropriate checks before he took up his post was suspended as soon as these allegations came to light.
"He no longer works at the school. We can now move on from what has been an extremely difficult time for everybody."
After sentencing DC Pippa Hinds said: "Abusing his position of trust, he stored this material within an environment where young children were present.
"His calculating approach to the crime using the cupboard demonstrates how he thought he could evade the police and prosecution."