A man was given a conditional warning by the police last year after he was caught peeping at his National University of Singapore (NUS) hall mate while she was in the shower.
As part of the warning, he must remain crime-free for a year or he may be dealt with in court for both his older and new offences.
But he reoffended and molested another woman - his classmate - just two months after the police warned him.
Yesterday, the 26-year-old student, who has a girlfriend, was sentenced to nine months' jail and three strokes of the cane.
He pleaded guilty to insulting the modesty of a woman and molesting another. He cannot be named due to a gag order to protect his victims' identities.
The court heard that the man was outside a female toilet at one of the halls in NUS at around 5am on Nov 25, 2015, when he heard a 22-year-old woman taking a shower.
He entered the toilet, went into a cubicle beside hers and locked the door.
He then climbed up the partition and saw her in the nude. The woman rushed out when she spotted somebody spying on her and sought help from her friends.
Deputy Public Prosecutor Mark Yeo said: "The accused stayed in the locked cubicle. The victim and her friends then sought assistance from a security officer on campus who took a photo of the accused inside his cubicle."
The man then unlocked his cubicle door and surrendered himself. The police were also called in, added the DPP.
Following an investigation, the police gave the man a conditional warning in February last year but he reoffended two months later.
On April 19 last year, the man was working on his final-year project in one of the university's computer labs from around 7 pm in the evening.
His classmate, a 24-year-old woman, was also working on her project in the same room, accompanied by her boyfriend, who fell asleep at around 2am.
When she too fell asleep about two hours later, her classmate approached her and touched her private parts, rousing her from slumber.
She alerted the university's authorities before lodging a police report.
DPP Yeo urged District Judge Hamidah Ibrahim to sentence the man to nine months' jail with three strokes of the cane. He told the court that even though the man had been diagnosed with voyeurism and fetishism, these two conditions were not impulse control disorders.
The man is now out on bail of $10,000. He has been given orders to surrender himself at the State Courts on Aug 8 to begin serving his sentence.