Rihanna just scored three years of peace of mind ... because a judge has granted her request for a permanent restraining order against an obsessed fan who tried to break into her L.A. home last month.
TMZ broke the story ... Rihanna obtained a temporary stay-away order against a man named Steveland Barrow, after he was arrested for breaking into the home of Rihanna's neighbor. Cops told us Barrow believed the home belonged to Rihanna ... and even slept in one of the beds.
A judge made the temporary order permanent today, requiring Barrow to stay at least 100 yards away from Rihanna for the next three years.
In her request for a restraining order, Rihanna said she fears for her safety.