WILMINGTON, Del. (AP) — A former Delaware doctor convicted of illegally prescribing thousands of powerful painkillers will spend five years and 10 months in prison.

Charles Esham, 61, was sentenced Thursday after being found guilty by a federal jury of 39 counts of unlawful distribution of oxycodone in December 2019, the News Journal reported.

Evidence presented by prosecutors during a six-day trial indicated that Esham issued oxycodone prescriptions to several individuals without a legitimate purpose over the course of several years.

Many of the pills were then illegally diverted and sold for profit.

After the sentencing, U.S. Attorney David Weiss said that Esham wrote prescriptions “as if he were taking orders at an ice cream shop.”

Three other men who were part of the drug ring were indicted separately and have each pleaded guilty to drug charges, according to the newspaper.