The 21-year-old hacker who boasted about breaking into Miley Cyrus' Gmail account and posting racy photographs of the teenage star has been arrested in the US on fraud charges.

The arrest comes more than two years after US Federal Bureau of Investigation agents raided Joshua Holly's home looking for evidence in the case. In court documents, the FBI says that Holly was an accomplished spammer, who hacked a large number of Gmail and MySpace accounts.

But Holly hasn't been charged in the Miley Cyrus hack - instead, he faces more serious financial fraud charges for allegedly storing about 200 stolen credit card numbers on his computer. He could go to prison for 10 years and pay a $250,000 fine if convicted of the charges.

He was arrested, then released following his initial appearance in court, according to Assistant US Attorney Hilliard Hester. Holly is due back in court for a preliminary hearing on January 12 in US District Court for the Middle District of Tennessee. His lawyer, Sumter Camp Jr, did not respond to messages seeking comment for the story.

Holly, known by his hacker alias TrainReq, got a lot of attention after posting private photos of Cyrus, then just 15. In one photo, Cyrus poses in her underwear and in another she poses, clothed, in the shower.

In subsequent interviews Holly said that he downloaded the photos from Cyrus' Gmail account. He told Wired that he accessed the Gmail account by tricking a MySpace employee into giving him access to the company's administrative control panel, which included users' passwords.

Cyrus apparently used the same password - her dog's name plus her year of birth - for several accounts, Holly said in a radio interview after the hack. After obtaining the password, "I tried it out on her email and it let me in," he said.

The FBI raided Holly's Murfreesboro, Tennessee, home in October 2008, but a few months later, agents obtained a second warrant, authorising them to conduct a forensic examination of Holly's computer. That second search turned up the evidence that led to the criminal charges.

In a January 2009 affidavit, FBI Special Agent Victor Rodriguez said that Holly confessed to breaking into Cyrus' MySpace account and generating "significant revenue" from spamming. A search of Holly's bank records showed that he'd received $110,000 for internet advertising services, Rodriguez said.

Holly would send spam after breaking into victims' online accounts, according to the affidavit. "He often used accounts belonging to celebrities because of the high volume of Internet traffic they attracted," it states.

The Josh Holly named in the affidavit is the same Josh Holly who was arrested last week on the credit card possession charges, according to Scott Augenbaum, supervisory special agent with the FBI's Memphis Division cybercrime squad. Augenbaum declined to comment further on the case.

Holly had left Tennessee, but FBI agents had hoped to arrest him while he was visiting his family for the Christmas holidays, according to court filings. More charges in the case are "likely", Rodriguez said in a December 2, 2010 affidavit.

See also: Miley Cyrus hit by Twitter hack