He also ruled that the alleged stalker was unfit to stand trial and he ordered that the accused should be committed to a psychiatric hospital in Staten Island, New York.
However, Mr McGlynn has filed a petition seeking release from the psychiatric institute.
The court ordered that the man must stay away from the ‘Diamonds’ hitmaker’s home in Manhattan and the police have been directed that they can arrest him if he is found near the singer’s property.
The accused – who was arrested in July this year on alleged stalking offences – has also been banned from contacting the 26-year-old singer by telephone, mail or computer.
The 54-year-old homeless man was arrested after reportedly writing a series of notes to the singer, which made references to murder and sexual assault.
He also is believed to have accused Rihanna of using his own material in her songs and he was spotted outside her home.