They came by the thousands – some from as far away as Cape May, some to wait in lines 100 people deep – seeking the autograph of the man inside a South Philadelphia storefront.

The man with the sought-after signature was no movie star, sports phenom, or celebrity, but, rather, a soft-spoken doctor – one who admitted Wednesday that he had turned his substance-abuse clinic into one of the city's most notorious sources for addicts and drug dealers of highly regulated prescription medications.

Federal authorities likened Alan Summers' now-defunct National Association for Substance Abuse-Prevention and Treatment, near Broad and Wolf Streets, to an open-air drug market. As he overprescribed medications such as the anti-anxiety drug Klonopin and Suboxone, a treatment for heroin addiction, patients openly bought and sold his prescriptions in his waiting room.

"Dr. Summers and many of the other doctors employed by him abandoned the practice of medicine and simply became drug dealers," Assistant U.S. Attorney Robert J. Livermore wrote in court filings.

The case against Summers, prosecutors said, demonstrates that even as law enforcement officials have gained ground against a widening epidemic of opiate abuse, a robust black market has sprung up around drugs prescribed to wean addicts off harder narcotics.

Summers, 78, of Ambler, said little about the illicit business that earned him $5 million between 2001 and 2014 as he pleaded guilty Wednesday to charges including conspiracy, drug distribution, money laundering, and health-care fraud. He sat quietly in the courtroom, answering questions from U.S. District Judge Lawrence Stengel, while his lawyer, Caroline Cinquanto, rubbed a comforting hand on his back.

"I think when he had an opportunity to grasp the enormity of the situation and saw how things had grown out of control, he wanted to do the right thing and accept responsibility," Cinquanto said after the hearing. Summers always believed, she added, that the core of his practice was helping patients overcome their addictions.

Investigators with the U.S. Drug Enforcement Administration began investigating Summers in 2013 and over three years sent at least four undercover officers and cooperating patients into his clinic, according to court filings.

One woman – a pharmacist who had become addicted to oxycodone after it was prescribed to treat a legitimate medical condition -- compared Summers' practice to "a crack house."

She told agents that patients, many of whom were clearly high on heroin at the time, lined up for mass therapy sessions where members of the doctor's staff read off boilerplate speeches on addiction. Afterward, Summers or other doctors who worked at the clinic would herd them into conference rooms for cursory examinations that often lasted less than two minutes. At the end, every patient received a pre-printed prescription for Suboxone and Klonopin in dosages dependent on how much they were willing to pay -- $50 for a week's supply, $200 for a month's.

"It was like an assembly line," another patient who cooperated with the investigation was quoted as saying in court filings. "It was in and out, as fast as it could be."

Summers' prescriptions for drugs such as Suboxone proved popular with drug dealers because unlike with methadone, another opioid used to treat heroin addiction, doctors can issue long-term prescriptions, sparing patients the need to show up to a clinic for each daily dose.

But some witnesses told investigators that a healthy trade in Suboxone-positive urine samples sprung up in Summers' waiting room among patients who were not taking the drugs the doctor had prescribed, but selling them on the streets instead. They said that lasted until they realized that Summers did not care whether their urine tests showed they were following his prescription recommendations.

When patients failed to report symptoms that the drugs were approved to treat, Summers and his staff made them up, prosecutors said. One undercover investigator posing as a patient told Summers he needed the drugs simply because they made him "feel good."

Before issuing a prescription, Summers wrote on that man's chart: "Patient is in denial with life's struggles, placing the blame on everyone else other than where the blame needs to be. Patient is having a lot of anxiety with panic attacks and trouble sleeping," according to the doctor's plea agreement.

Agents arrested Summers last year along with two other doctors at his clinic. One, Keyhosrow Parsia, 80, of Ridley Park, pleaded guilty to charges last month. The other, Azad Khan, 64, of Villanova, awaits trial.

Under the terms of his plea agreement with prosecutors, Summers will likely face a maximum sentence of just more than seven years at a hearing scheduled for May.

"Dr. Summers has had a long, successful career treating people with medical and psychiatric illnesses," Cinquanto, his lawyer, said. "He's cared for people in the community very well. The last couple of years, he ran a practice that simply ran away from him."