A drug-dealing Virginia doctor who illegally prescribed 500,000 opioid pills to patients over a two-year period was sentenced Wednesday to 40 years in prison, authorities said.

Dr. Joel Smithers, a married father of five from North Carolina, was also ordered to pay an $86,000 fine for prescribing fentanyl, oxycodone and other opioids to patients from states including Virginia, West Virginia, Kentucky and Ohio after a majority of them traveled hundreds of miles to score the drugs, federal prosecutors said.

“This physician perpetuated, on a massive scale, the vicious cycle of addiction and despair,” US Attorney Thomas Cullen said in a statement to the Martinsville Bulletin. “Although the sentence imposed is severe, it serves as just punishment for an individual whose actions caused the death of one person and wrecked the lives of many others.”

Smithers, 36, was convicted in May on 861 federal drug charges, including 859 counts of illegally prescribing controlled substances to every patient in his Martinsville practice starting in September 2015. A jury also found that Smithers caused the death of a West Virginia woman after prescribing her oxycodone and oxymorphone.

The doctor, who did not accept insurance, raked in at least $700,000 in cash and credit card payments in the scheme before investigators armed with a search warrant raided his office in 2017, federal prosecutors said.

“This is the worst case I have ever seen,” Judge James Jones said during Smithers’ sentencing, a Drug Enforcement Administration spokeswoman told the Bulletin. “It was purely a pill mill.”

Smithers, a doctor of osteopathic medicine, testified during his nine-day trial that he had a few patients from Virginia, but most of them came from Kentucky and West Virginia after hearing of his practice via word of mouth, NPR reports.

“Those were the two main places,” Smithers said, according to court documents. “I think there were a few patients from Tennessee because Tennessee had shut down some clinics as well. And, I mean, it was just kind of word of mouth. I never really advertised. I had a sign out in front of my office.”

One patient testified that he drove up to 10 hours from his home in Kentucky to Virginia to get his hands on oxycodone and hydrocodone pills, according to NPR.

Smithers had faced up to life behind bars and a fine of more than $200 million, federal prosecutors said.

Roughly 192 drug overdose deaths are reported nationwide every day, according to the Centers for Disease Control and Prevention.

In 2017, more than 70,000 people died of drug overdoses in the United States, with the highest rates reported in West Virginia, Ohio and Pennsylvania. Opioids were involved in more than 67 percent of those fatalities, CDC stats show.