A maths teacher from a West Yorkshire high school took secret photographs of girls in his classroom and sent them to a known sex offender.
Dominic Peachey was locked up for 16 months after a court heard how he used pictures of girls in school uniform to exchange for graphic images of child sex abuse.
Peachey sent the images to Welsh Government lawyer John Ryan-Guess who then sent the teacher the vile images in return.
Former barrister Ryan-Guess was jailed for more than 20 years in August last year for sexually abusing young girls then sharing pictures and videos of his abuse on the internet with other paedophiles.
Peachey's offending came to light when officers in South Wales were carrying out the investigation into Ryan-Guess.
Officers searched the paedophile's computers and found a file named 'Dominic My Choices'.
Within that file were sub-files called "Special Stuff" and "Those From People I Know".
They contained images taken secretly by Peachey while he was teaching in a classroom at the West Yorkshire school.
Some were of girls wearing uniform and focused on their crotch area. One was of a girl, aged 12 or 13, bending over looking in her handbag.
The information was passed to West Yorkshire Police who contacted the school and confirmed the images were taken in one of their classrooms.
Peachey was arrested and computers and mobile phone devices belonging to him were found to contain illegal images.
Fourteen illegal movies and still images were at category A - the most serious level of offending.
Category B and C images were also found along with pornographic images depicting animals.
Peachey, also known as Dominic Peachey-Moore, refused to comment when first interviewed.
He later accepted that he had taken the images of the girls without their knowledge and sent them to another man.
Peachey, of Carr Street, Selby, pleaded guilty to nine offences of making indecent images of children and three of possessing extreme pornographic images.
NONE of the charges relate to any of the images of the children at Peachey's school.
Mark Foley, mitigating, said Peachey was married and had a child.
Mr Foley said the defendant had no previous convictions and had been assessed by the probation service as being a low risk of re-offending.
He added: "The impact of this offending is that he has lost job and lost his character.
"This is a man who was a teacher but is now a pizza delivery driver.
"It will affect him and his future for many years to come."
Judge Tom Bayliss, QC, told the defendant that although the images he had taken of the schoolgirls do not form any part of the charges, it was still an aggravating feature of the case.
He said: "None of the children or their parents gave you permission to take them.
"You used them as a bargaining tool.
"You were actively involved in a networking process - in the sharing of indecent images of children.
"You took photographs of children you had a duty of care for as a school master.
"You shared those with a known sex offender.
"In my judgement there has to be a substantial prison sentence to bring it home to anyone else that such behaviour will be tolerated."
A spokesperson for the school said: “The school acted swiftly and decisively when informed by the police of the arrest of Mr Peachey-Moore and he was suspended immediately with his employment terminated shortly afterwards.
"The school also referred his case to the Teaching Regulation Agency and the Disclosure and Barring Service. Our safeguarding of students remains of the very highest standard with all stringent checks and systems in place to ensure our children are safe in school.”