Refusing to take "no" for an answer, a construction worker from Bangladesh followed a young woman home, barged in, and groped and tried to undress her.
Yeasen Arafat Sayed Ahmed backed off only after she shouted repeatedly for him to leave while pointing a knife at him.
District Judge Kamala Ponnampalam, calling it one of the worst cases of aggravated molestation she had seen, sentenced the 30-year-old to three years in jail and six strokes of the cane.
She said: "I can't ignore the fear you've put her in and the trauma she suffered."
Arafat, who said he had worked in Singapore for about six years, kept his head down during the hearing.
The 20-year-old woman from China was staying with her father, who was working in Singapore, in a rented room in a Geylang house. She was here on a social visit pass.
Around noon on June 24, when she was hanging laundry in the alley behind, Arafat approached her. She waved him off but he followed her into the building through the back door.
When she told him in Mandarin to get out, he grabbed her arm.
She pushed his hand away and locked herself in her room upstairs, but he waited outside until she opened the door 10 minutes later. He forced his way in and locked the door behind him.
She threatened to call the police but that did not stop Arafat from moving towards her with his arms outstretched.
He hugged her from behind as she tried to call her father on her mobile phone, and squeezed her breasts.
He also touched her buttocks and tried to pull her shorts down.
When she grabbed a knife, he disarmed her and again touched her breasts and thigh.
He left only after she picked up the knife again. She locked the door and called her father and the police, squatting and crying in a corner of the room.
Since the incident, the woman, whose identity is the subject of a gag order, has been living in fear. She refuses to remain at home alone and needs to sleep with the lights on, Deputy Public Prosecutor Jeremy Lua told the court.
Arafat's persistent attempts to remove the girl's clothes suggested that he had "wanted something more", Mr Lua added.
For outraging the modesty of his victim while wrongfully restraining her, Arafat, who also admitted to trespassing, could have been jailed for between two and 10 years and caned.