Superior Court Judge Carol Boas Goodson ordered Jean Christophe Prudhon of Dijon, France, to stay 100 yards away from the "Spider-Man" star and to stop trying to contact her.
In letters accompanying Dunst's petition, Prudhon wrote that he sold his home in France so he could continue to travel to meet Dunst, who has not responded to any of his more than 50 letters. He wrote that he is in love with the actress and that he has repeatedly waited outside Dunst's home to try to meet her and has been mistaken for a paparazzo.
"I am frightened for my safety, as well as the safety of my family and friends who visit my home," Dunst wrote in a court filing. "I am worried that Mr. Prudhon will escalate his conduct further, putting myself and my family in danger."
Dunst's mother, Inez Dunst, wrote in a sworn declaration that she was alarmed by Prudhon's appearance when he came to her door last week trying to meet the actress. Inez Dunst said she knew who he was because he has repeatedly sent her daughter letters over the years.
It could not be immediately determined if Prudhon, 51, was represented by a lawyer, and attempts to locate him for comment were unsuccessful.
The actress, who recently appeared in the film "Melancholia," wrote in a court filing that her security personnel told Prudhon to stay away, but he has refused.
Goodson will consider whether to grant a three-year restraining order at a Dec. 21 hearing.