PHOENIX — Drugmakers that produce opioid painkillers and allied advocacy groups have spent more than $880 million on campaign contributions and lobbying over the past decade as they worked to influence state and federal policies, including tens of thousands of dollars in Arizona.

A joint investigation by The Associated Press and the Center for Public Integrity chronicled the spending as the nation deals with a rash of overdoses, most of which are attributed to prescription drugs or heroin.

Members of the Pain Care Forum, a loose coalition of drugmakers and dozens of nonprofit groups supported by industry funding, gave $121,158 to candidates and state parties between 2006 and 2014 in Arizona. The spending is significantly on the lighter side when compared to other states. Arizona ranks 40th for having the largest portion of its total contributions come from Pain Care Forum members.

In the same period, drug overdose deaths have risen by 38 percent in Arizona, according to the Centers for Disease Control and Prevention. In 2006, there were 876 deaths. That figure trended upward to 1,222 in 2013 and has since hovered around that point.

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 nationally.

The report comes as Arizona voters will decide whether to legalize recreational marijuana in the November election — a campaign that has also seen big-money influence by an opioid maker.

An Arizona-based pharmaceutical company that sells a potent opiate-based oral spray plowed $500,000 into the campaign opposing pot legalization. The donation by Insys Therapeutics touched off outrage among supporters of the ballot measure that allows people over the age of 21 to possess up to one ounce of pot. The company also has plans to manufacture a synthetic cannabinoid whose potential market would be undercut by pot legalization.

Three opioid-related bills have come up in the last two years in the Arizona Legislature, each progressively broader in its approach to tackling the potential danger for addiction.

In January 2015, state senators proposed two bills that would call for more use of a state prescription monitoring program, which has accumulated data since 2009. One bill proposed that medical practitioners check the program’s database before filling a prescription for a state Medicaid patient. The other bill called for a contractor to intervene if the database indicates a Medicaid patient has obtained 10 or more prescriptions for controlled substances in a three-month period.

Legislation that became law in this year’s session will make it mandatory for doctors to check the statewide database before prescribing any addictive pain medications such as oxycodone. The bill passed unanimously and will take effect in October 2017.