"The harm cannot be overstated," Rufe told the 72-year-old physician. "You made a hypocrisy of your Hippocratic oath."
In addition to the prison term - Rufe said the sentence was necessary to deter other doctors from using their offices as "pill mills" - she ordered Gosnell to forfeit $200,000 linked to prescription trafficking and fined him $50,000.
Gosnell pleaded guilty in July to federal charges involving the sale of almost a million pills containing the narcotic painkiller oxycodone and the generic version of the antianxiety drug Xanax.
Those two drugs and scripts for more than 19,000 ounces of codeine-based cough syrup - all coveted by addicts - were allegedly sold for cash out of Gosnell's clinic from 2008 through January 2010.
A former triathlete, Gosnell, clad in an olive-green prison jumpsuit, stood bolt upright in court and spoke in a clear, mellifluous baritone. For much of his address to the judge, he tried to walk a tightrope between calling his trade in prescriptions the result of errors and "accepting full responsibility for the problems that occurred under my watch."
Defense attorney Jack McMahon said he thought Gosnell sincerely believed in the "higher purpose for what he was doing."
Despite the crimes to which he pleaded guilty, Gosnell spent decades delivering medical care to the poor and uninsured of the city's Mantua section at little or no cost, McMahon said.
Assistant U.S. Attorney Jessica Natali argued that audio and video recordings made by a cooperating drug dealer of meetings with Gosnell showed that money, not altruism, motivated the doctor.
Natali said one tape featured Gosnell describing the difficulty of signing 200 bogus prescriptions in one sitting.
One dealer, identified by the initials "T.J.," picked up 19 prescriptions in the names of eight people, Natali said. Another, "C.L.," controlled 52 names for which no patient files existed.
"He was filling orders on demand, keeping costs low and volume high," Natali added.
Gosnell's sentencing on federal drug charges came almost four years after the Feb. 18, 2010, raid by a federal-local drug task force at his Women's Medical Society at 3801 Lancaster Ave.
There, investigators found what they were looking for and a lot that they were not: evidence that Gosnell was performing hundreds of illegal late-term abortions.
It was the beginning of the end for Gosnell, whose name became a battle cry to opponents of legalized abortion. The evidence found at his clinic resulted in a Philadelphia grand jury probe. A jury convicted him of first-degree murder, and in May, a Common Pleas Court judge sentenced Gosnell to the three consecutive life terms.
Once Gosnell was sentenced on the state murder charges, McMahon and federal prosecutors began trying to resolve the "pill mill" case.
It wasn't easy. Twice, Gosnell balked at the last minute at deals offered by federal prosecutors, seemingly unable to admit that he had committed a crime.
When Gosnell finally pleaded guilty in July to the drug charges, it was only after the judge spent about 15 minutes verbally sparring with the doctor before he reluctantly uttered the word guilty.
Even Monday, Rufe complained that Gosnell - who had written her an eight-page single-spaced letter contesting elements of his presentence investigation report - "was backtracking . . . trying to change the landscape."
Gosnell's sentencing will permit the sentencing of former clinic employees charged in the federal and state cases. All had pleaded guilty and agreed to testify against Gosnell but were not sentenced in case the doctor tried to back out of his federal guilty plea.
Gosnell, who had been held at the Federal Detention Center in Philadelphia, is to be transferred to the state prison system.