A science teacher “persistently and deliberately” filmed dozens of adult and underage females going to the toilet in schools, a court has heard.

Rahul Odedra placed small cameras secured with Blu Tack in the toilets of the schools.

The 46-year-old former science teacher appeared at Gloucester Crown Court on Wednesday where he was sentenced to four years and three months in prison for 23 offences of voyeurism and of making or attempting to make indecent images of children.

Anjali Gohil, for the prosecution, said the offences came to light after a pupil “noticed that Mr Odedra appeared to be trying to film up her skirt” and reported him.

Ms Gohil said: “When the police examined the footage that was seized from Mr Odedra there were over 200 videos.

“They were all of women or females.

“They appeared to focus upon either looking up a skirt … or carefully planned recordings of women using toilets.”

The court heard Odedra, of Quedgeley, Gloucestershire, placed his recording devices – a two-inch camera – in toilets of the schools, either facing the toilet or secreted in toilet roll holders.

Ms Gohil said he used Blu Tack to secure the devices and that some of the equipment was found in his teacher’s bag.

Ms Gohil said the prosecution could not say Odedra’s “primary target” was capturing footage of children and the majority of the videos showed adults but that he had kept – and cropped – footage of children.

The court heard Odedra confessed in his second police interview and expressed remorse and shame but denied he had received any sexual gratification from watching the content and claimed he was instead interested in the “thrill of filming”.

Joe Keating, for Odedra, said since then his client had come to a “gradual understanding” that there had been an “element of sexual gratification”.

“He states this was born out of an interest in voyeurism and voyeuristic videos seen on porn sites,” said Mr Keating.

“He says that his primary interest was in adults.”

Mr Keating said Odedra’s career was ruined and he would never be able to teach again something he had felt was “very much a calling” and “something he was good at”.

He added that Odedra wanted to serve his sentence so he could start to rebuild his life.

At an earlier hearing, Odedra pleaded guilty to 20 counts of voyeurism, two counts of making an indecent image of a child and one of attempting to make an indecent image of a child.

The offences took place over an eight-year period at three different schools and at another location.

Sentencing him, Judge Ian Lawrie QC said: “You are before this court facing the consequences of what is clearly a long-held secret compulsion to voyeuristically look at females.

“That is a toxic secret.”

Judge Lawrie said Odedra’s actions had been “persistent and deliberate”.

“It is clear that your actions, although you didn’t realise it at the time, which I find surprising, caused immeasurable harm to the victims,” he added.

Odedra was made the subject of a sexual harm prevention order and was ordered to sign the sex offenders’ register for life.