CBS/AP/ March 6, 2013, 2:12 PM

Man ordered to stay away from Alyson Hannigan

Actress Alyson Hannigan attends the 7th Annual March of Dimes Celebration of Babies at the Beverly Hills Hotel on Dec. 7, 2012, in Beverly Hills, Calif.

Actress Alyson Hannigan attends the 7th Annual March of Dimes Celebration of Babies at the Beverly Hills Hotel on Dec. 7, 2012, in Beverly Hills, Calif. / Michael Buckner/Getty Images

A Los Angeles judge has ordered a man to refrain from posting anything online about Alyson Hannigan or to try to meet the "How I Met Your Mother" star.

Superior Court Judge Carol Boas Goodson issued a three-year restraining order against John Hobbs after a brief hearing Wednesday.

26 Photos

Stalked stars

Hannigan stated in court filings last month that Hobbs has posted a barrage of threatening messages about her and her family online.

The filings state the 43-year-old acknowledged to police that he wanted to meet the 38-year-old actress and mother of two.

Goodson noted that Hobbs agreed to the terms of the restraining order and that Hannigan's husband and daughters also should be protected.

The actress did not attend the hearing.

© 2013 CBS Interactive Inc. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.