He told her to call him "Papa" and treated her like a daughter, even picking her up from school and giving her pocket money.
But when the 13-year-old was alone in his home with him, he sexually assaulted her after massaging her legs.
On another occasion, he undressed her in the middle of the night and tried to molest her, even as her friend lay sound asleep next to her.
The 48-year-old divorced father of two was yesterday sentenced to eight years' preventive detention and six strokes of the cane.
The unemployed man, who cannot be named to protect the identity of his victim, had earlier pleaded guilty to one count of sexual assault, a molestation charge, and a charge of intentionally perverting the course of justice.
Court documents showed that the man first met the student in the first half of 2017, while she was hanging out with some friends at a public pavilion.
The man appeared before the group and introduced himself as "Papa". The girl would then see him every time she hung out in the area.
Deputy Public Prosecutor Lee Zu Zhao said: "Eventually, the victim became closer to the accused and regarded him as her godfather because he treated her like a daughter."
She also regarded his home as a "safe haven" to hang out in.
Some time between August and September 2017, the girl went over to the man's flat with a friend. The man's son was there as well.
The girl and the man were left alone when her friend and the man's son, whose age was not stated in court documents, left the home.
While they were alone, the man massaged her legs but then went on to undress her. She told him she was uncomfortable but he told her to "relax" and went on to sexually assault her.
"When he did so, the victim felt great discomfort and told him to stop. The accused complied," said DPP Lee.
Some time between December 2017 and January 2018, the man attempted to molest the girl while she was sleeping in his flat with a friend.
She woke up to find her pants and underwear down to her knees, and quickly pulled them up and got out of bed.
The girl's mother eventually found out what happened and lodged a police report. When the girl informed the man about the report, he went into hiding.
He later texted her via Instagram to ask her what she had told the police, and scolded her for betraying him.
The court heard yesterday that the accused had previously been convicted and imprisoned for rape. The man told the court that he was very remorseful and sorry for causing harm to the victim.
"I sincerely plead with your honour and the DPP to trust me one more time, to give me one more chance," he said.
However, District Judge Carol Ling said it was expedient for the protection of the public that the accused should be detained for a "substantial period of time".
For sexual penetration of a minor, the man could have been jailed for up to 20 years and fined or caned.
Correction note: This article has been edited for clarity.