A man accused of threatening Alyson Hannigan online has been ordered to stay away from the actress for three years.

The American Pie star obtained a temporary restraining order against John Hobbs last month, amid allegations he had been harassing her via a number of social networking websites.

Her lawyer moved to make the protection order permanent and on Wednesday, a Los Angeles judge agreed to extend the ban until 2016, according to TMZ.com.

In her original complaint, Hannigan claimed Hobbs was "mentally unstable and was recently discharged from a mental hospital."

The restraining order also protects her actor husband Alexis Denisof and their young daughters, Satyana and Keeva Jane.