When federal agents raided the Pittsburgh-area office of Dr. Bernard L. Rottschaefer, the resulting allegations came as a shock to the 63-year-old man's friends and family: Rottschaefer, the office of U.S. Attorney Mary Beth Buchanan alleged, had been writing prescriptions for anti-anxiety medication and opiate painkillers like OxyContin in exchange for sex.

Rottschaefer's arrest came at the height of a nationwide moral panic over prescription painkiller abuse. His 2004 trial came just after the Orlando Sentinel newspaper had published a landmark series on abuse of the painkiller OxyContin, a series that inspired Congressional hearings and legislation across the country-and a series the newspaper later had to retract in its entirety, and for which the paper eventually fired an editor and reporter.

Buchanan (who now heads up a domestic violence program within the Department of Justice) was politically savvy, ambitious, and had taken on a number of high-profile cases that made her a rising star in the Bush administration, including spending $12 million to nab 55 people on low-level charges of selling glass-blown bongs over the Internet (including pot celebrity Tommy Chong).

Buchanan also brought the first federal obscenity case in 15 years.

As the Drug Enforcement Administration initiated a high-profile anti-opiate campaign in the early 2000s, it began raiding the offices of pain doctors all over the country. DEA officials and prosecutors held press conferences boasting of the doctors they'd nabbed. Many of these prosecutions were dubious. The government was mistaking a promising new form of pain treatment, sometimes called high-dose opiate therapy, for what it called white-collar drug dealing.

What's more, the government insisted (and still insists) it needed to show no motive and no criminal intent to convict these doctors of drug dealing. It only needs to show that a given doctor's prescriptions are outside the course of normal medical practice-a standard to be determined by government drug cops, not medical boards. Given her history of embracing high-profile, high-publicity cases, it's of little surprise that Buchanan would find a doctor in her own district to help her tap the ongoing painkiller hysteria.

Rottschaefer was eventually convicted on 153 of 208 counts of illegally prescribing prescription painkillers. Five women testified that Rottschaefer wrote them prescriptions for which prosecutors say there was "no legitimate medical purpose."

Buchanan also played up the salacious sex allegations in public, and her subordinates played them up in the courtroom. From a perception standpoint, the sex allegations were important, because Dr. Rottschaefer clearly wasn't prescribing these pills to get rich-he was getting approximately $6 per month for three of the patients, and approximately $22 per month for the others. All were on government assistance.

Government witness Dr. Douglas Clough confidently told jurors that there was nothing in the five women's medical histories that would have called for the drugs Dr. Rottschaefer prescribed. Rottschaefer was sentenced to 6.5 years in prison, later reduced to five.

Even before the jury returned its verdict, there were problems with the government's case. Start with Dr. Clough, who despite government assertions to the contrary is no expert on pain treatment. When questioned on the witness stand, Clough was unaware of some basic legal guidelines any doctor who regularly prescribes pain medication should have known.

For example, he was ignorant of the fact that at the time, it was illegal for a doctor to post-date a prescription for opioid painkillers. Clough also didn't review all of the five witnesses' histories, only those portions of them provided by the government. He didn't speak to or examine any of the women. For this, the government then paid him approximately $11,000.

Four of the five women who testified against Dr. Rottschaefer alleged a sex-for-drugs arrangement. But all four initially denied any sex took place. They changed their stories after conversations with federal prosecutors. It so happens that all four were also facing their own criminal charges at the time, and it's now clear that all four received reductions in their own charges or sentences in exchange for their testimony.

Not only was the jury not told about these arrangements, it was explicitly told precisely the opposite-that there were no testimony-for-leniency deals.

In 2005, as Dr. Rottschaefer was appealing his conviction, the government's case took yet another blow. The ex-boyfriend of Jennifer Riggle, the government's star witness, gave Rottschaefer's lawyers 183 letters Riggle sent to him while he was in prison. In them, Riggle admits over and over again that she fabricated the sex-for-drugs stories about Dr. Rottschaefer and lied about them in court.

"I think they want to subpened (sic) me to a grand jury about the doctor I was seeing," Riggle wrote in one letter. "They're saying he was bribing patients with sex for pills, but that never happened to me. DEA said they will cut me a deal for good testimony."

Federal prosecutors have never charged Riggle with perjury.

Remarkably, Riggle's letters weren't enough to win Dr. Rottschaefer a new trial. Buchanan's office argued that Riggle's letters were irrelevant, because Buchanan's public grandstanding on the sex allegations notwithstanding, the case was never about sex, but about Rottschaefer prescribing drugs for no legitimate medical purpose. In 2006, a federal appeals court agreed, and denied Rottschafer a new trial.

Now there's new evidence undercutting the "legitimate medical purpose" argument, too. All five women who testified against Rottschaefer have sued him in civil court for medical malpractice. So far, none of those suits have been successful-three of eight remain unresolved.

The lawsuits did, however, allow Rottschaefer's lawyers to look at the women's entire medical histories, not just the portions prosecutors provided at trial. What they found ought to be enough to set Rottschaefer free.

It's now clear that all five women perjured themselves in Rottschaefer's criminal trial-both about the bargains they'd struck with federal prosecutors, and about their own medical histories. One failed to inform the jury that she'd been diagnosed with several psychological disorders, allowing the jury to conclude that a breakdown she'd suffered in 2002 was due to the drugs Dr. Rottschaefer had prescribed her, not her underlying medical conditions.

The other four had been or were later treated with medications similar to those Dr. Rottschaefer prescribed, and for the same conditions he had diagnosed. Meaning that not only were Dr. Rottschaefer's actions not outside the scope of accepted medical practice, they were actually duplicated by other doctors.

It's unclear if Buchanan and her subordinates are guilty of basic incompetence here, or something more sinister. That they could look at what's come out since Dr. Rottschaefer's conviction and still feel he belongs in prison is telling, as is the fact that they've yet to charge their star witness with perjury, despite overwhelming evidence that she committed it.

When their "sex for drugs" allegations have been deflated, they fall back on the "no legitimate medical purpose" arguments. Now that those charges have been refuted too, their latest brief goes back to the sex.

If federal prosecutors did know about any of this new evidence at the time of the trial, they're guilty of prosecutorial misconduct. If they didn't, they're guilty of being duped by these five women. Of course, that's essentially the same thing for which they've convicted Dr. Rottschaefer.

"Dr. Rottschaefer got five years in a minimum security prison," says Siobhan Reynolds of the Pain Relief Network, an advocacy group for pain patients. "But he's still trying to get a new trial, even though if he's convicted, that sentence will be thrown out, and he could get 25 years or more. That seems like a risk someone would only take if he's innocent, doesn't it?"

That isn't a legal argument, of course. But outside the courtroom, it's a pretty persuasive one.

Radley Balko is a senior editor with Reason magazine. He publishes the weblog, TheAgitator.com.