A US man, charged with sending more than 27 million spam messages to Facebook users, has turned himself in.

Sanford Wallace, known as the ‘Spam King’, surrendered to FBI agents in California.

Prosecutors allege he developed a program that breached Facebook spam filters and lured users to submit their account details.

Mr Wallace denies the charges, which include 11 counts of fraud, intentional damage to a protected computer and criminal contempt for violating previous orders to stay off the social networking sites Facebook and MySpace.

Accounts of about 500,000 Facebook users were compromised between November 2008 and March 2009, leading to more than 27 million spam messages being sent, federal prosecutors said.

Facebook previously sued Mr Wallace in 2009 and a federal judge had ordered him not to access Facebook's computer network. But he repeatedly violated that order earlier this year, the prosecutors said.

In that civil lawsuit, the judge awarded Facebook some $711m, although the company said it did not expect to receive much of that amount. Facebook welcomed the new indictment.

'We will continue to pursue and support both civil and criminal consequences for spammers and others who attempt to harm Facebook or the people who use our service,' Chris Sonderby, a lawyer for the company, said in a statement.

Mr Wallace made an initial appearance in federal court on Thursday and was released on $100,000 bail. He pleaded not guilty.

He was again ordered not to access MySpace or Facebook.

'Mr Wallace looks forward to defending himself,' said his lawyer KC Maxwell.

If Mr Wallace is convicted, the six fraud counts are subject to a maximum three-year prison term.

The three counts of damage to a protected computer carry a maximum sentence of up to 10 years. The two criminal contempt counts are subject to penalties determined by the court.