Alyson Hannigan Gets Restraining Order After Threats

ABC News' Linsey Davis reports:

Actress Alyson Hannigan has obtained a temporary restraining order against a man she says has threatened her and her family.

The court order, issued Wednesday, requires 43-year-old John Hobbs of New Hampshire to stay away from the 38-year-old Hannigan and her family and to stop posting messages about her online.

Hannigan stars in the hit sitcom "How I Met Your Mother," and also starred in the cult hit TV series "Buffy the Vampire Slayer." She also appeared in the "American Pie" movies.

RELATED: Cast of 'American Pie,' Then and Now

In her petition, the actress said Hobbs posted "a barrage of threatening messages directed at me and my family on various websites." The messages suggested he would rape her and take her to the "after-life," she also wrote, adding that she was in "severe fear" for her safety and that of family.

Hannigan is married to her "Buffy" co-star, actor Alexis Denisof. The pair have two young children. The restraining order covers Denisof and the children.

RELATED: 'Buffy the Vampire Slayer:' Where Are They Now?

Hobbs recently was released from a mental hospital, according to the court filings.

Police say Hobbs seemed to be living in an alternate reality, posting messages to Hannigan on Facebook and calling her husband, Denisof, "Mr. Evil Pooh."

"I can still marry you tomorrow. I also can kill you tomorrow too. Cause I simply like and love you as you live life. Aly…it doesn't end. Even after death," read one of Hobbs' Facebook postings, according to police.

"By making those threats, he has potentially violated the federal stalking law," said Brad Garrett, a former FBI agent and ABC News consultant. "A lot of this is driven by delusions. He's created this love relationship."

A hearing to extend the restraining order for three years is scheduled for March 6 in Los Angeles.

Both Hobbs and Hannigan declined to comment to ABC News.

The Associated Press contributed to this report.