"American Pie" star Alyson Hannigan has obtained a restraining order against a man she claims is mentally unstable and threatened to kill her, TMZ has learned.
The "How I Met Your Mother" actress filed a request for a restraining order in L.A. County Superior Court, claiming John Hobbs has been harassing her on the Internet -- posting threatening messages on Facebook, MySpace, and Alyson's website.
Hannigan says Hobbs is "mentally unstable and was recently discharged from a mental hospital."
Alyson says Hobbs also suggested he would rape her -- posting a message online that reads, "Lets see How can I get myself in troble today [sic]. If I go with what I've been acussed of Most of my Life, I suppose I should start with being a rapist, so any nice girls out there want to get raped [sic]?"
In addition to herself, Alyson got protection for her husband and two kids.
A hearing has been set for March 6th ... when a judge will decide whether to make the restraining order permanent.