In an unusual step, Diamond went far beyond the sentence recommended by prosecutors and federal guidelines and ordered Gidelson, 36, to prison for four years, starting right away.
The judge cited secretly recorded conversations in which Gidelson, he said, sounded like "a drug dealer who thought the world of himself."
"He preened, he boasted, he bloviated," Diamond said, later adding, "That he had served as a police officer makes his fall into criminality all the more serious."
Gidelson was arrested in April 2011, after agents from the Drug Enforcement Administration and U.S. Postal Inspection Service intercepted steroids shipped to him from overseas.
Prosecutors said he catered to a growing roster of steroids users he met at fitness clubs in the city. He used coded messages to conduct business and kept a loaded pistol under his bed at his Northeast Philadelphia home.
Authorities weren't sure how long the ring ran - one informant suggested Gidelson had started in 2009, after going out on medical leave but while still an officer. But they estimated that it had become Gidelson's sole source of income, and that he sold more than 10,000 injections and pills before getting caught.
"Keith Gidelson was a calculating, organized drug dealer," Assistant U.S. Attorney David Axelrod told the judge. His operation "was only going to get bigger."
Diamond notified the lawyers last week that he was considering going beyond the 30- to 37-month term recommended in Gidelson's plea agreement on drug and conspiracy charges.
Still, the sentence surprised Gidelson's lawyer, Nino Tinari, who said after the hearing he would consider an appeal.
Tinari said Gidelson was "more sick than sinister." He had asked the judge for a lower term than the guidelines suggested, arguing that Gidelson accepted responsibility, quickly cooperated, and had already been vilified in the media. Tinari also presented a psychologist who testified that Gidelson suffered from job-related posttraumatic stress disorder, explaining his behavior.
"Highly dubious" was the judge's response. Diamond said he saw no proof that Gidelson's medical condition led him to sell drugs. "You committed the crimes," Diamond said.
He also ordered Gidelson to pay a $25,000 fine and serve three years of supervised release after prison.
Fourteen others, including Gidelson's wife, Kirsten, pleaded guilty in the case. Later Monday, the judge sentenced Kirsten Gidelson to three years' probation, with one year served in home confinement. That punishment was less stringent than the 6- to 12-month prison term recommended by federal guidelines.
Diamond noted that Kirsten Gidelson was only a "minor" participant in her husband's crimes, and that she has a 16-year-old daughter to care for. If not for her husband, the judge said, Kirsten Gidelson probably wouldn't have been standing before him.
Contact John P. Martin at 215-925-2649, firstname.lastname@example.org or @JPMartinInky on Twitter.