A Virginia doctor received a 40-year prison sentence Wednesday for illegally prescribing more than half a million doses oxycodone, hydromorphone, fentanyl and other opioids to patients for years.

Authorities say Dr. Joel Smithers operated a "pill mill" out of Martinsville, Va., located about 15 miles north of the Virginia-North Carolina border and about 175 miles southwest of Richmond.

The U.S. District Court for the Western District of Virginia handed down the sentence in a courtroom in Abingdon. The sentence includes 20 years for Smithers' conviction for prescribing opioids that caused the death of a woman in West Virginia.

In addition to the prison time, he was assessed a $86,000 fine and will serve three years of supervised release upon the completion of his prison time, according to court documents.

The sentence is lighter than it could have been. Smithers was facing up to life in prison and a fine of more than $200 million, according to officials at the U.S. Justice Department.

Smithers was convicted by a jury in May on more than 800 federal drug charges — including one count of possessing with the intent to distribute controlled substances and one count of maintaining a place for the purpose of unlawfully distributing controlled substances.

He was also convicted on hundreds of counts of unlawfully distributing a controlled substance without a legitimate medical purpose or beyond the bounds of medial practice, including the two counts, listed in court documents as counts 298 and 299, that lead to the death of the West Virginia woman.

When Smithers, a resident of Greensboro, N.C., opened his Virginia practice in 2015, Justice Department officials said he prescribed controlled substances to "every patient in his practice, resulting in over 500,000 Schedule II controlled substances being distributed."

His Martinsville office was raided by federal agents in 2017.

Authorities say Smithers ran an operation that was less a medical practice and more an interstate drug distribution network and patients came from surrounding areas within Virginia, as well as from Ohio, Tennessee, Kentucky and West Virginia.

Some traveled "hundreds of miles" to visit Smithers to get their drugs, according to a May press release by the U.S. Attorney's Office in the Western District of Virginia.

"Smithers did not accept insurance and took in over $700,000 in cash and credit card payments prior to a search warrant being executed at his office on March 7, 2017," the statement said.

During the trial Smithers testified he received a lot of patients through word of mouth.

"Well, a few patients from Virginia, but most of them, through word of mouth, would come from Kentucky and West Virginia. Those were the main two 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," Smithers said.

A man testified during the trial he would drive between 8 and 10 hours from his home in Kentucky to the Virginia practice and back.

The man admitted he was addicted to oxycodone and hydrocodone and began to see Smithers after another doctor refused to give him pills.

"There wasn't — there wasn't no doctors in my area like that to see," the man said about why he would make the trek.

Ahead of Smithers' sentencing a man named Dan Myers, who said he was a friend of Smithers and his family, urged the court to consider the "demonstrated positive attributes of [Smithers'] character" when mulling the length of punishment.

"Joel is clearly proud of being a doctor and frequently spoke of his desire to help others. He felt very blessed to be in a position to assist his patients," Myers said in a letter dated Sept. 25.

According to the Centers for Disease Control and Prevention more than 700,000 people died in the United States from drug overdoses between 1999 and 2017, including 70,000 in 2017 alone.

Of those 2017 deaths, the CDC said nearly 68% were linked to prescription or an illicit opioid.

NPR intern Paolo Zialcita contributed to this report.

Copyright 2019 NPR. To see more, visit https://www.npr.org.