It was 2015, and the company identified only as “Pharma Co. X” in court documents had a problem on its hands.

The number of people dying of opioid overdoses was spiraling at an alarming rate, and doctors nationwide were being forced to reckon with the growing crisis. Many were becoming more cautious, prescribing lower doses of opioids to patients who complained about pain, or even advising against the drugs altogether. For Pharma Co. X, which prosecutors describe as a “major” manufacturer of opioids, that represented a serious threat.

But an up-and-coming tech start-up hailed as “the Facebook of health” presented a solution, according to a court statement released Monday by the U.S. attorney’s office for the District of Vermont. The San Francisco-based company, Practice Fusion, had developed a free software program that combed through data that doctors entered and suggested next steps for a treatment plan.

And in exchange for $1 million in kickbacks, its employees were willing to work with the pharmaceutical firm’s marketing team to make sure that those next steps were likely to include opioids.

The result was tens of thousands of additional prescriptions for extended-release opioids that may not have been medically necessary, prosecutors allege. Now, Practice Fusion is on the hook for $145 million, the largest criminal fine in Vermont’s history.

The company, now under different ownership, admitted Monday to the kickback scheme as part of a deferred prosecution agreement.

Calling the behavior “abhorrent,” Christina E. Nolan, the U.S. attorney for the District of Vermont, said in a Monday statement that Practice Fusion had allowed the opioid manufacturer “to inject itself in the sacred doctor-patient relationship” during the height of the crisis.

“The companies illegally conspired to allow the drug company to have its thumb on the scale at precisely the moment a doctor was making incredibly intimate, personal, and important decisions about a patient’s medical care, including the need for pain medication and prescription amounts,” she said.

The fact that Practice Fusion gave away its software free made it popular with smaller medical offices and solo physicians, CNBC reported in 2018, noting that the company said advertising to doctors was its main source of revenue.

Started in 2005, when most medical providers were still dependent on archaic computer systems, the company let physicians document patient visits, order prescriptions and lab tests, and easily access their records online. Before long, it had received hundreds of millions of dollars in venture capital funding, expanding to fill several floors of an office building in downtown San Francisco by 2013.

A headline in TechCrunch that year noted that the company aimed to “bring a big data cure to the healthcare crisis.” That meant “combining Yelp-like reviews with an Uber-style on-demand booking service” for doctors, and incorporating an expense-tracking feature that the company thought would help patients struggling to pay their medical bills.

It also involved offering medical providers something known as “clinical decision support,” an increasingly popular tool that uses patient data to alert doctors about tests they may want to order or medications that might interact badly.

The computer-generated suggestions looked like “unbiased medical information,” prosecutors wrote in court filings laying out the allegations, but Practice Fusion was actually letting Pharma Co. X decide when doctors would receive an alert. A marketing employee from the pharmaceutical company was even allowed to draft some of the language, despite lacking a medical degree or any experience prescribing opioids.

As a result, prosecutors say, the software’s recommendations went against accepted medical standards. When patients repeatedly complained that they were in pain, the menu of suggested treatments that popped up listed opioid therapy alongside other, less risky interventions such as physical therapy or a referral to a specialist.

But the alert didn’t ask doctors to consider alternative treatments before prescribing the drugs, and didn’t warn them about the high risk of addiction and abuse.

The software also encouraged doctors to repeatedly ask patients about their pain, which Pharma Co. X anticipated would lead to an increase in opioid prescriptions, prosecutors said. The drugs were even suggested for patients who didn’t experience severe pain, or who experienced isolated episodes of acute pain over several months but didn’t suffer from round-the-clock discomfort.

When Practice Fusion and Pharma Co. X began their discussions in November 2013, the two companies talked about creating an automated alert that would help identify patients who were at risk of becoming addicted to opioids, prosecutors say. But that plan was soon abandoned, and Pharma Co. X allegedly agreed in 2015 to sign a $1 million contract with the understanding that Practice Fusion would help increase sales by targeting people who had never been prescribed opioids before.

“Marketing personnel within Pharma Co. X also liked that the proposed Pain CDS allowed Pharma Co. X to, in essence, be present in the exam room while they interacted with patients,” prosecutors wrote.

According to court filings, the rigged alerts popped up on doctors’ computers more than 230 million times between July 2016 and the spring of 2019, when criminal charges were filed. The health-care providers who received them prescribed extended-release opioids at a higher rate than those who didn’t, prosecutors say.

In a statement Monday, Timothy M. Dunham, special agent in charge of the FBI’s Washington Field Office, blamed Practice Fusion for fanning the flames of the opioid epidemic. The company “exploited technology to profit at the expense of a vulnerable population — patients seeking medical advice,” he said.

It’s unclear how the investigation of Practice Fusion came about. The company was acquired by rival Allscripts in 2018, CNBC reported.

A vice president for Allscripts released a statement on Monday in response to inquiries from TechCrunch, saying that the company had “further strengthened Practice Fusion’s compliance program” since it learned about the allegations and was dedicated to using technology to fight the opioid epidemic.

Practice Fusion agreed to pay the $145 million in fines as part of the agreement that will resolve multiple criminal and civil investigations of its software, prosecutors said Monday. The company was charged with violating the federal Anti-Kickback Statute and conspiring with Pharma Co. X, and will have to create a website detailing its misconduct as part of the agreement.

At a news conference Monday in Vermont, officials didn’t say whether Pharma Co. X would also face sanctions, VTDigger reported.