NORFOLK, Va. - A Virginia doctor who wrote thousands of fake prescriptions for an infamous black market pharmacy has entered a guilty plea, despite earlier backing out of a plea deal, prosecutors said Wednesday.

Lawrence Ryan, 48, backed out of a plea deal last month but then changed his mind and admitted to conspiracy to unlawfully sell prescription drugs to consumers without valid prescriptions, The Virginian-Pilot reported.

From October 2007 to September 2010, Ryan worked for a black market pharmacy called RX Limited where he would sign off on prescriptions for a fee without ever seeing any patients, according to the Department of Justice.

Ryan approved more than 158,000 illegal drug orders for RX Limited, the department said. He was paid $2 per prescription for a total of at least $316,153, according to court records.

The site was founded by weapons and drug trafficker Paul Le Roux, but Ryan’s attorney said his client didn’t know Le Roux’s connection to RX Limited until he read about him in The Virginian-Pilot.

“He never met Le Roux,” Trey Kelleter said of his client. “He didn’t know Le Roux existed.”

Ryan was a former Navy doctor who was first licensed to practice in Virginia in 2001, the newspaper said. His license was suspended in May 2006 after it was discovered he was sending adult and child pornography to people who turned out to be Naval Criminal Investigative Service officers, the paper said citing documents filed with the Virginia Board of Medicine.

After a clinical psychologist interviewed Ryan and determined he was “not a child pornographer and had no sexual interested in children,” the board reinstated the Norfolk doctor in February 2007.

A sentencing hearing is set for April 6. He faces up to five years in prison.