The man was convicted of aggravated child pornography crimes and child rape on Friday.
He admitted that he raped a child in December 2016, but claimed that the victim was not the seven-year-old boy with whom he was caught in September last year.
The District Court in Lund said it believed the 7-year-old was indeed the victim.
The police investigation found that the man had regularly worked as a guardian for the child at weekends when the mother was at work. The child had sometimes slept over at the home of the man, who had previously been convicted of sexual crimes against children.
In September the man was seized at a train station in Landskrona in the company of the tearful seven-year-old boy, thanks to train staff who called the police.
The man was travelling on a train going towards Malmö together with the boy, who was in tears.
Several of the passengers noticed the boy and alerted train staff. They described the man as strange. The boy was crying for his mother and did not appear to know the man.
When the train stopped at the station in Landskrona, the man and the boy got off. A train attendant, who had attempted to speak with the boy to ask him if he knew the man, quickly followed.
“I ran after them and yelled at him to let the boy go. I then got hold of the boy's arm and after a while the man let go. I then yelled at the man to stay where he was and he actually did,” she told the Sydsvenskan newspaper at the time.
Police were called and arrested the man. They found child pornography at the man's home.
The train attendant told Sydsvenskan she had no choice but to act. “He was so tiny and desperate, I had to do something. I cried with him. No child should have to experience something like that.”