ALBANY, N.Y. — New York ranked fourth among states whose lawmakers drew the most contributions from the opioid industry but was near the bottom in prescriptions per capita, according to data compiled by The Associated Press and the Center for Public Integrity.

Lobbyists for a loosely affiliated group of drugmakers and nonprofits in the Pain Care Forum show they had 206 registered lobbyists in Albany last year, donating $288,500 to state candidates and committees last year, and $3.7 million over the past decade.

Amid the lobbying, lawmakers and the Cuomo administration the past few years have adopted measures to limit painkiller prescriptions and prevent “doctor shopping” to obtain extra pills to illicitly resell or feed addictions.

Data show more than 10 million opioid prescriptions issued statewide last year, down slightly from the previous two years.

Data also show that the state’s drug overdose deaths, a majority attributed to opioids and heroin, rose 37 percent over eight years, reaching 2,300 in 2014.

In June, Gov. Andrew Cuomo signed a law to limit opioid drug prescriptions to seven days of painkillers following a patient’s initial visit to a doctor. It contains exceptions for chronic pain and hospice and palliative care.

“Our medical professionals and our pharmacists are truly a part of this issue. They have been writing prescriptions for more painkillers than people need,” Cuomo said. He didn’t mention pharmaceutical companies in those remarks.

The measure was proposed by a state task force to find ways to address the rise in addiction and overdoses. Other provisions in the law require insurers to cover initial inpatient drug treatment without prior approval and extend from 48 to 72 hours the time someone can be held for emergency treatment.

In December, Cuomo, a Democrat, vetoed a bill approved by the Legislature and backed by major drug companies that would have required insurers cover new formulations of opioids that are harder to crush or dissolve, thwarting abusers who want to snort or inject painkillers. Another provision would have prohibited pharmacists from substituting other drugs for prescribed opiates with “abuse-deterrent technologies.”

In his veto message, Cuomo wrote that the bill’s intent was laudable, but research on the new drugs’ effectiveness was limited and they’re approximately two to three times more expensive than other opioids.

The Legislature passed another version of the bill this year. The measure is under review by the governor’s counsel, spokesman Richard Azzopardi said.

Gabriel Sayegh, former managing director of the Drug Policy Alliance in New York, said the rise in opioid prescriptions and overdoses followed the lifting of the federal prohibition in the 1990s on direct drug company marketing to consumers. Meanwhile, the 50-year “war on drugs” left the country ill-equipped to address the health problem of addiction relegated to police and prosecutors, who are finally beginning to change the conversation, though lawmakers have been slow and afraid to follow, he said.

A joint investigation by the AP and the Center for Public Integrity found that drugmakers that produce opioid painkillers and allied advocacy groups spent more than $880 million on campaign contributions and lobbying over the past decade as they worked to influence state and federal policies. The groups have an array of political interests that include opioid advocacy, and their spending was eight times that of the gun lobby during the same period. By comparison, groups advocating for limits on opioid prescribing spent about $4 million.

Drug companies say they are committed to solving the problems linked to their painkillers. Purdue Pharma, one of the largest opioid producers by sales, said it does not oppose policies “that improve the way opioids are prescribed” even if they result in lower sales.