Judge Lady Wise also ordered that 33-year-old David Johnston should be monitored in the community for two years after his release from prison in order to protect the public.
She told Johnston: “You lured a six-year-old girl who was out playing in the street with her brother. You then took her to a secluded place behind a billboard and you were found with your hands on the girl’s shoulders. Your victim was initially inconsolable after her terrifying ordeal.”
Lady Wise praised residents in the east end of Glasgow who searched along with police for the little girl, who was wearing a Disney Princess Frozen dress.
She said to Johnston: “You were caught thanks to the efforts of the local people and the police.”
The judge said that, but for his early plea of guilty, she would have jailed Johnston for eight years.
Defence counsel Tony Graham said that Johnston was drunk and had taken a legal high called Bubble that night.
Mr Graham added: “His behaviour that night was bizarre, but he had no memory of it.
“However, he accepts the evidence against him.”
The court was told that Johnston was out on licence at the time as he had been released early from his sentence for a racially aggravated offence on July 17 – 21 days before he abducted the young schoolgirl.
Johnston’s sentence was meant to finish on September 17.
Johnston, who is a prisoner in Barlinnie, admitted abducting and sexually assaulting the girl with intent to rape on August 7.
He was placed on the sex offenders’ register.