A federal judge sentenced John Kapoor, the founder of the opioid manufacturer Insys Therapeutics, to 5 1/2 years in prison Thursday for his role in a racketeering scheme that bribed doctors to prescribe a highly addictive opioid and misled insurers.

The case had been closely watched because it represented a rare criminal inquiry into the practices of a drug company that aggressively sold painkillers while the nation was in the grip of a deadly opioid epidemic that killed thousands of people in the last decade.

Beth Wilkinson, a lawyer for Kapoor, declined to comment on the sentencing but said she planned to appeal.

Federal prosecutors have said that Insys, based in Arizona, embarked on an intensive marketing plan — including paying doctors for sham educational talks and luring others with lap dances — to sell its under-the-tongue fentanyl spray, Subsys, which was federally approved to treat patients with cancer.

Doctors were urged to write prescriptions for a much wider pool or patients, and to mislead insurance companies so they would pay for the expensive medication.

Judge Allison D. Burroughs of U.S. District Court in Boston also sentenced other former Insys executives this week for their roles in the scheme. They included the former vice president of sales, Alec Burlakoff, 46, of West Palm Beach, Florida, who was sentenced Thursday to 26 months in prison and three years of supervised release.

On Wednesday, the judge sentenced the company’s former chief executive, Michael L. Babich, 43, of Scottsdale, Arizona, to 30 months in prison and three years of supervised release. In January 2019, Babich pleaded guilty to one count of conspiracy to commit mail fraud and wire fraud and one count of mail fraud, and agreed to cooperate with the government.

Other executives who were sentenced included Sunrise Lee, a former regional sales director, who was sentenced to one year and one day in prison; Joseph A. Rowan, another former regional sales director, who was sentenced to 27 months in prison; and Richard M. Simon, a former national director of sales, who was sentenced to 33 months in prison. A former vice president, Michael J. Gurry, was sentenced to 33 months in prison earlier this month.