Gidelson was still on the city payroll but on disability leave in August 2010 when a confidential source told authorities he bought steroids from the detective, Assistant U.S. Attorney David L. Axelrod told the judge.
In the ensuing months, investigators from the Drug Enforcement Administration and the Postal Service launched surveillance of Gidelson's home, tapped his cellphone, and monitored his mail.
Axelrod said he was not sure how much Gidelson made, but said steroid sales had become a primary source of his income, netting thousands of dollars a month.
In April 2011, agents intercepted two shipments that had been mailed to Gidelson. Each had nearly 70 injection doses and 2,000 pills. Weeks later, a grand jury indicted Gidelson; his wife, Kirsten; and 13 others on conspiracy and drug charges.
The others were individual users and some who resold drugs to their own clients. The latter group included two other police officers, Joseph McIntyre and George Sambuca. Like Gidelson, they have been dismissed from the force and pleaded guilty.
Gidelson was the 14th defendant to plead out in the case. The lone holdout, Christian Kowalko, faces trial in December.
Nearly all of the others, including McIntyre, Sambuca, and Kirsten Gidelson, are scheduled to be sentenced later this year.
Gidelson declined an invitation by the judge to explain his crime, indicating he instead wanted to do so at sentencing.
But both he and his lawyer, Nino V. Tinari, offered a glimpse of what that explanation might be. Gidelson told the judge that he became addicted to painkillers after suffering a serious injury in an on-the-job car crash in 2006. He has since been treated for the pill addiction, post-traumatic stress disorder, anxiety, and other ailments.
Tinari said after the hearing that the loss of his job, the addiction to painkillers, and other personal problems fueled Gidelson's slide into drug sales.
Contact John P. Martin at 215-854-4774, at firstname.lastname@example.org or follow @JPMartinInky on Twitter.