A judge has been criticised after he described jailing a paedophile primary school teacher as a "tragedy" and a "loss to the community".

Richard Oldham, 32, was sentenced to six months after he pleaded guilty to voyeurism, making indecent images of a child and sexually assaulting two boys at Leeds Crown Court.

Oldham, now of North Tamerton, Cornwall, admitted to groping his victims and filming children as they changed in the swimming pool. He was described by police as "every parent's worst nightmare".

However, despite admitting 23 sex offences over eight years, Judge Jameson said that Oldham was "man enough" to battle his demons and that he is a good teacher who should be "treasured".

Upon sentencing, Jameson told Oldham: "It's a loss to the community. Good teachers are not a rare commodity but when they're found they should be treasured.

"This is, in the classic sense of the word, a tragedy - that somebody with your ability, and the good in you, was not able to control successfully instincts that led you to commit these offences."

He told Oldham the six-month sentence "for you will be a very severe punishment".

David Hines, of the National Victims' Association charity, said he was "gobsmacked" by the judge's remarks.

"This offender is not a treasure or an asset to the community, he's clearly a horrible man. The judge ought to go back to school and learn the meaning of the word treasure," he said.

An NSPCC spokesman said: "A good teacher commands the unquestioning trust of pupils and parents, however talented they may be at teaching.

"We doubt many parents will be sad to see him put in jail."

'Prison is the right place for him'

Aisha Wadoodi, prosecuting, said Oldham committed a number of offences across several primary schools in the York area between 2004 and 2012.

Police also discovered more than 2,000 indecent images of children on his home computer, some of which were level four severity, which the judge described as "the rape of children".

Det sgt Adam Normanton, of North Yorkshire Police, described Oldham as a "predatory peaodophile".

He said: "It is quite apparent by evidence obtained during the course of the investigation that he actively pursued a career in teaching to enable himself a position where he could abuse children for his own sexual gratification.

"His wickedness is such that he particularly abused the children who he thought would either not tell anyone or would not be believed.

"Oldham tried to portray himself as the model teacher to the police, his colleagues and his family. He was in fact the opposite, he was every parent's worst nightmare and prison is the right place for him."

The judge also imposed a sexual offences prevention order on Oldham, told him to sign the Sex Offenders Register for 10 years and banned him from working with children for life.