Rihanna has obtained a restraining order after a crazed fan was captured walking on the roof of her house.

Pop superstar Rihanna is reportedly living in fear after a crazed fan broke into her home in the Pacific Palisades area of Los Angeles,

The 25-year-old Diamonds singer has obtained a restraining order against Robert Melanson after he was captured walking on the roof of her house, TMZ reports.

According to the celebrity site, RiRi believes Melanson poses a risk to her life and has enlisted the help of her lawyers to prevent him from getting close to her.

Under the terms of the temporary order, Melanson faces prison if he comes within 100 yards of Rihanna, her house and her place of business.

Melanson was spotted lurking on Chris Brown's ex-girlfriend's roof with detailed property maps in hand on 17 June. He was placed under a psychiatric hold but released two days later.

In the legal documents, obtained by TMZ, Rihanna claimed she fears for her safety because Melanson is unstable and has a criminal history.

Rihanna will allegedly attempt to make the restraining order permanent on 10 July.

Earlier in June, the Bajan beauty was caught on camera purportedly hitting an over-eager concert goer in the face with her microphone during a concert in Birmingham.

In a video posted online, she is seen launching her microphone in the air and slamming it into one fan's face after the unidentified woman tried to grab her arm.

Rihanna later defended her actions by claiming she struck the supporter in self-defence.

"That B-tch wouldn't let me go," she wrote in Instagram.