Self-described spam king Sanford Wallace surrendered to the FBI today after being indicted on charges he broke into Facebook accounts to send 27 million spam e-mails on the social network.

Wallace, 43, was indicted in July by a San Jose, Calif., grand jury on three counts of intentional damage to a protected computer and two counts of criminal contempt, according to the U.S. Attorney's Office in the Northern District of California. Wallace allegedly compromised approximately 500,000 Facebook accounts during three separate attacks on the social-networking giant between November 2008 and March 2009.

If convicted of all charges, Wallace could face nearly 40 years in prison and fines of more than $2 million.

Wallace, who was ordered by U.S. District Court Judge Jeremy Fogel in 2009 not to access Facebook, was also charged with violating that order by accessing the social network on an airline flight from Las Vegas to New York in April 2009 and by maintaining an account under the name David Sinful-Saturdays Fredericks for a few weeks earlier this year.

Fogel awarded $711 million to Facebook against Wallace in October 2009 for violating the Can-Spam Act, which bans "false and misleading" marketing e-mails. At the time, Fogel also found that Wallace "willfully violated" a temporary restraining order and preliminary injunction issued in the case and referred the matter to the U.S. Attorney's Office for prosecution of criminal contempt, which resulted in the the indictment.

The case stemmed from a lawsuit Facebook filed against Wallace and two others in February 2009 that alleged they used phishing sites or other means to fraudulently gain access to Facebook accounts and used them to distribute phishing spam throughout the network.

Wallace earned the nicknames "Spamford" and "spam king" for his past role as head of CyberPromotions, a company responsible for sending as many as 30 million junk e-mails a day in the 1990s.

In May 2008, Wallace and another defendant were ordered to pay MySpace.com $234 million following a trial at which Wallace repeatedly failed to turn over documents or even show up in court.

Wallace has also been previously sued by the Federal Trade Commission and companies such as AOL and Concentric Network. In May 2006, Wallace and his company Smartbot.net were ordered by a federal court to turn over $4.1 million.