Actress Alyson Hannigan obtains restraining order

FILE - This Dec. 7, 2012 file photo shows actress Alyson Hannigan from the CBS comedy, "How I Met Your Mother," at the March of Dimes Celebration of Babies in Beverly Hills, Calif. Hannigan obtained a temporary restraining order on Wednesday, Feb. 13, 2013 claiming a New Hampshire man recently released from a mental institution has been threatening to kill her and harm her family in online postings. (Photo by John Shearer/Invision/AP, file)

LOS ANGELES (AP) — A judge Wednesday granted Alyson Hannigan a temporary restraining order from a man who she claims has repeatedly threatened her and her family in online postings.

The order requires John Hobbs, 43, to stay away from the "How I Met Your Mother" actress and her family, and it orders him to stop posting messages about her online.

Hannigan states in her petition that in the past two months, Hobbs, a New Hampshire resident, has "posted a barrage of threatening messages directed at me and my family on various websites."

The actress wrote that she has never met Hobbs, but his messages have suggested he will rape her and take her to the "after-life." Hobbs recently was released from a mental hospital, according to the court filings.

"I am in severe fear for my safety and the safety of my family," she wrote.

FILE - This March 19, 2012 file photo shows actress Alyson Hannigan, a cast member in "American Reunion," posing with her husband, actor Alexis Denisof, at the premiere of the film in Los Angeles. Hannigan obtained a temporary restraining order on Wednesday, Feb. 13, 2013 claiming a New Hampshire man recently released from a mental institution has been threatening to kill her and harm her family in online postings. (AP Photo/Chris Pizzello, file)

Police in Hobbs' hometown of Nashua, N.H., contacted him and he acknowledged wanting to meet Hannigan, 38, and visit her in California.

"Hobbs seemed to be living in an alternate reality," the officer wrote after interviewing him and reviewing his Facebook account.

A phone number registered to Hobbs has been disconnected.

A hearing to extend the restraining order for three years is scheduled for March 6 in Los Angeles. The order also covers Hannigan's husband, Alexis Denisof, and their children, ages 1 and 3.

Hannigan rose to fame after appearing in the movie "American Pie." She also starred in "Buffy the Vampire Slayer."