Image caption Sanford Wallace, pictured in 1997, has a long history of sending junk mail

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

Sanford Wallace, who is 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 carry prison sentences of up to 10 years.

He has been released on $100,000 (£61,000) bail.

Prosecutors say Mr Wallace's program posted messages on Facebook users walls - purportedly from friends - urging users to visit a website where their account details were then harvested.

They were then redirected to an affiliate website that earned Wallace "substantial revenue", the charges say.

The program also retrieved lists of Facebook users' friends and posted spam messages on their walls, the indictment adds.

About 500,000 Facebook accounts were compromised between November 2008 and March 2009, leading to more than 27 million spam messages being sent, prosecutors said.

Mr Wallace, who is from Las Vegas, is charged with six counts of electronic mail fraud, three counts of intentional damage to a protected computer and two counts of criminal contempt.

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

Mr Wallace also lost a civil case brought against him by MySpace in 2008 over junk messages sent to members of the social networking site.