James Moran, 32, silently led the child to a store cupboard at her school as she made her way back from the toilet.
When she refused his demand to removed her clothes he took hold of her and stripped her naked - apart from her socks and shoes.
The child grabbed her clothes back from Moran as he used both hands to take a picture of her with his mobile phone.
Moran fled and the child returned to her class where she told her teacher of her ordeal and later pointed out her attacker in the school saying “it was him”.
Moran, of Dalmarnock, Glasgow, pled guilty to abducting the schoolgirl on May 2, this year at a primary school in the city.
He also admitted sexually assaulting her by causing her to participate in sexual activity, forcing her to remove her clothes and underwear and taking a naked picture her.
Sheriff Alan Mackenzie sentenced Moran to three years behind bars and put him on the Sex Offenders’ register indefinitely.
Passing sentence he told Moran: “The crimes you committed involves a six year-old child in an environment where she ought to have been safe and secure.
“One where her parents anticipated she would be.
“I consider that the offences are of the utmost gravity, I am in no doubt as has been recognised, no other disposal other than a custodial one is appropriate.”
Glasgow Sheriff Court heard Moran was employed by Cordia to carry out work in the school and had been working for four or five years.
Staff said the role was “limited to school crossings, moving furniture and litter picking” and he had no direct interaction with children.
He was described as a “loner” who had “limited communication skills”.
Defence lawyer Bill McCluskey said his client is described as “painfully shy”.
He said Moran’s family have been the subject of online abuse as a result of his actions and he was keen not to put the child’s family through a court process.