A Los Angeles judge granted Cyrus a temporary restraining order against Devon Meek, reported Ace Showbiz.
Meek from Sierra Vista, Arizona was detained by police on May 16 outside a property while trying to meet Cyrus, and was later placed in a psychiatric hospital.
The 24-year-old believed the 'Adore You' singer was communicating with him through her songs. According to Cyrus' lawyers court documents, Meek has said he will continue hunting the star once he's released from the facility.
According to detective Rosibel Smith, Meek told the officers that they should shoot him in the head if he couldn't meet the singer.
Smith said a police officer who interviewed Meek "informed me that Mr Meek stated that when he is released from the hospital, he will not stop seeking Ms Cyrus and that he will continue to go to Ms Cyrus' residence until she accepts him or he dies."
The restraining order requires Meek to stay within 100 yard away from Cyrus. A hearing is scheduled on June 16 to extend the restraining order for three years.