An ex-primary school teacher has pleaded guilty to downloading indecent material of children from the internet and filming school pupils while they were getting undressed for sport.

Richard Michael Watkins, 28, resigned as a teacher at Derry Hill School near Calne, after his arrest in November last year at his home in Braemor Road, Calne. Police found 23,537 indecent images of children that had been stored on his home computer over a two-year period.

A dozen parents and staff from were at North Wiltshire Magistrates Court in Chippenham on Tuesday to hear Watkins plead guilty to 13 offences, including downloading indecent material of children from the internet and voyeurism, where he took photos covertly, using a camera-pen, while the pupils got changed for sport.

The content of downloaded material from the internet includes more than 170 images of children and seven movies that were categorised as level five, the worst.

The court was told that Watkins’ wife, from whom he now lives apart, was pregnant at the time of his arrest.

“The implications for the family are immense. At the time of arrest they were expecting their first baby,” said William Hazelton, defending.

“His baby was born in January this year.

“He feels total shame; he knows he has let himself, his wife and family down,” said Mr Hazelton.

“He’s let the school down and the children there.

“He always thought he would be a school teacher for life. It was a job he was good at and he enjoyed doing it.

Prosecutor Alastair Nisbett appealed successfully to presiding magistrate Peter Francis to send the case to crown court for sentencing .

He said: “Here we are talking about images of eight-year-old children in a primary school, while the person taking these images is a teacher. You may feel that is a fairly extreme breach of trust.

“He admitted that he had taken these (photos) with a view to keeping them and viewing them later for his own gratification.

“If you saw them you would be aware that he would be lingering over particular children that he found attractive.”

Police were alerted by a website tracking firm that a computer, identified by its IP address as belonging to Watkins, had been used to download indecent images of children from the internet.

When the former children’s entertainer, who has circus skills training, was arrested in November, he admitted the offences and even volunteered the camera pen that he had used to take photos of schoolchildren.

“When Mr Watkins was arrested he immediately acknowledged that he was responsible for everything that was found on his computer,” said Mr Hazelton.

“He went on to be very open with the officers about the background. He told the officers that this went back to when he was a young teenager and he found material on the internet.”

Making/downloading indecent images of children carries a potential sentence of 10 years in prison, while voyeurism carries a maximum sentence of two years, according to the prosecution.

Watkins has been released on bail to an address in Dorset and a date for his sentencing at Swindon Crown Court is yet to be set.