A US judge has ordered a spammer to stay away from Facebook.

Facebook sued Sanford Wallace and two other men last week in an effort to cut down on spam and phishing schemes littering the site. Judge Jeremy Fogel issued a temporary restraining order barring Wallace, Adam Arzoomanian and Scott Shaw, from accessing Facebook.

The social network argues that these men gained access to legitimate Facebook accounts and then used them to spam the profile pages of the account holders' friends, by posting messages on their 'walls'.

The spam messages served two functions - they enticed users into visiting phishing websites where they could be tricked up into giving up their Facebook login credentials, and they routed victims to commercial websites that paid the spammers for the traffic, Facebook said.

Wallace is one of the US's most notorious spammers, with a career that dates back to the 1990s. Last May, a judge found him and a partner guilty under the CAN-SPAM act and ordered them to pay $230m for phishing and spamming MySpace users with links to gambling, ringtone and pornography websites.

Spammers and phishers have been hitting Facebook particularly hard over the past year and a half, said Dave Jevans, chairman of the Anti-Phishing Working Group. Because Facebook spam often looks like it comes from a friend it can be very effective. And because it's web-based, it skirts traditional email spam filtering tools, Jevans said.

"Some of the bigger guys can get a million people a day to look at their stuff," he said. "It's occasional, but you'll see it."

Spam is just one of several ills plaguing the social network. Over the past few days, Facebook users have been hit with four hoax application scams and a new strain of the Koobface worm, which tries to trick victims into installing malicious software onto their PCs.

Late last year, the judge in the Wallace case awarded Facebook a record $873m in damages after Facebook accused other spammers of using stolen logins to pump out more than four million spam messages. Facebook says that it doesn't expect the spammers in that case to pay up, but the company hopes that it may serve as a deterrent.

Jevans agreed that lawsuits probably won't stop the big-time Facebook spammers, but he said they could deter the little guys.

See also: Five Facebook scams & how to avoid them