Transcript for Alyson Hannigan Gets Restraining Order Against Alleged Stalker

stalker scare for the star of "how I met your mother," allisyson hannig hannigan. She and her husband getting death threats from a man just out of the mental hospital with a legal permit to carry a gun. This one time, at band camp. Reporter: The flame-haired actress who rose to fame in "american pie." You know what I do when I'm angry? Reporter: Says she's not only angry, but afraid for her safety. Allisyson hannigan, who sta on "how I met your brother," says she's being terrorized by a stalker. A lot of this is driven by delusions. He's created this love relationship. Reporter: In her petition, the 38-year-old actress states hobbs has posted a barrage of threatening messages directed at me and my family on various websites. Police say hobbs is unstable and was recently discharged from a mental hospital. It notes he seemed to be living in an alternate reality. Posting messages like this on facebook. I can still marry you tomorrow. I also can kill you tomorrow, too, because I simply like and love you as you live life. Aly, it doesn't end, even after death. Hobbs refers to hannigan's husband, alexis, as mr. Evil 2. In one post, he provides his phone number and address, suggesting they talk in person. On several occasions he mentions plans to visit her in california. By making those ly violated stalking laws. Reporter: Experts say the problem will only get worse. Technology is a big contributor to the stalking problem. You have people thinking they're talking to celebrities. Reporter: Hobbs and hannigan declined commenting to abc news. But it likely goes without saying that hannigan wouldn't mind he apparently posted line. Saying, to get my memory erased, well, all the things I thought or feel for you. For "good morning america," linsey davis, abc news, new york. A scary situation.

This transcript has been automatically generated and may not be 100% accurate.

Now Playing: Amy Adams Juggles Two Men and Two Accents in 'American Hustle'

Now Playing: {{itm.title}}

{"id":18510897,"title":"Alyson Hannigan Gets Restraining Order Against Alleged Stalker","duration":"2:13","description":"A man who's been accused of harassing the actress has been released from a mental hospital.","url":"/GMA/video/allyson-hannigan-stalker-met-mother-star-restraining-order-18510897","section":"GMA","mediaType":"default"}