Rihanna's stalker has been sentenced to six days in jail and three years probation.

Robert Melanson, who the 'Stay' hitmaker has secured a temporary retraining order against, was arrested for creeping around on the roof of her Los Angeles home earlier this month and pled ''no contest'' after being charged with criminal trespassing.

A judge sentenced Melanson, 26, to time served in jail (six days), three years of probation and also to one year of mental health treatment.

He also fined him $344, according to gossip website TMZ.com.

Rihanna, who was in the UK on her 'Diamonds' world tour at the time of the incident on June 17, secured a temporary restraining order against the obsessed fan earlier this week.

The judge ordered him to stay at least 100 yards away from her house and, or, place of business.

Rihanna wrote she feared for her safety in legal documents because Robert is unstable and has a criminal history.

The singer will try and make the restraining order permanent on July 10.