The makers of prescription painkillers have adopted a 50-state strategy that includes hundreds of lobbyists and millions in campaign contributions to help kill or weaken measures aimed at stemming the tide of prescription opioids, the drugs at the heart of a crisis that has cost 165,000 Americans their lives and pushed countless more to crippling addiction.

The drugmakers vow they're combating the addiction epidemic, but the Associated Press and the Center for Public Integrity found that they often employ a statehouse playbook of delay and defend that includes funding advocacy groups that use the veneer of independence to fight limits on their drugs, such as OxyContin, Vicodin and fentanyl, the narcotic linked to Prince's death.

The industry and its allies spent more than $880 million nationwide on lobbying and campaign contributions from 2006 through 2015 — more than 200 times what those advocating for stricter policies spent and eight times more than the influential gun lobby recorded for similar activities during that same period, the AP and Center for Public Integrity found.

The drugmakers and allied advocacy groups — such as the American Cancer Society Cancer Action Network — also employed an annual average of 1,350 lobbyists in state capitals from Olympia to Tallahassee during that span, when opioids' addictive nature came under increasing scrutiny.

The pharmaceutical companies and allied groups have a number of legislative interests in addition to opioids that account for a portion of their political activity, but their steady presence in state capitals means they're poised to jump in quickly on any debate that affects them.

"The opioid lobby has been doing everything it can to preserve the status quo of aggressive prescribing," said Dr. Andrew Kolodny, an outspoken advocate for opioid reform. "They are reaping enormous profits from aggressive prescribing."

Prescription opioids are the ­cousins of heroin, prescribed to relieve pain. Sales of the drugs quadrupled from 1999 to 2010, rising in tandem with overdose deaths. Last year, 227 million opioid prescriptions were doled out in the U.S., enough to hand a bottle of pills to nine out of every 10 American adults.

The industry says it's committed to solving the problems linked to painkillers. Opioid-makers have launched initiatives to, among other things, encourage more cautious prescribing.

"We and our members stand with patients, providers, law enforcement, policymakers and others in calling for and supporting national policies and action to address opioid abuse," the industry group Pharmaceutical Research and Manufacturers of America said.

Doctors continue to prescribe opioids for ailments such as back pain and headaches, even though studies have shown weak or no evidence that the drugs are effective ways to treat routine chronic pain — and even though they come with the risk of addiction.

In 2007, executives at Purdue, the maker of OxyContin, pleaded guilty to misleading the public about the drug's addictive nature and agreed to pay $600 million in fines.

Lawmakers across the country have started attempting to limit the flood of prescribing and prevent overdoses. In 2012, for example, New Mexico considered a bill to limit initial prescriptions of opioids for acute pain to seven days to make addictions less likely and produce fewer leftover pills that could be peddled illegally. The bill died in the House Judiciary Committee.

"The lobbyists behind the scenes were killing it," said Bernadette Sanchez, the Democratic state senator who sponsored the bill.

Lobbyists for opioid makers and their allies declined to comment. But those groups had 15 lobbyists registered in New Mexico that year, up from nine the previous year. Among them were longtime players considered among the most influential advocates in Santa Fe.

Most judiciary committee members received drug industry contributions in 2012. Overall that year, drug companies and their employees contributed nearly $40,000 to New Mexico campaigns — roughly 70 percent more than in previous years with no governor's race on the ballot.

Pharmaceutical lobbyists are now pushing bills to fight opioid abuse that also promote a new product that pads their bottom lines: patent-protected abuse-deterrent opioids. They lobby for laws requiring insurers and pharmacists to give preferential treatment to the drugs, even though some experts say their abuse-deterrent qualities are easily circumvented.

Lawmakers have introduced scores of bills on the topic, with at least 21 using nearly identical language — some of it supplied by lobbyists.

One of the drugmakers' most powerful political engines is their financial support for opioid-friendly advocacy groups.

Such groups led the countercharge in Tennessee in 2014 when Republican state Rep. Ryan Williams began work to stanch the flow of prescription painkillers, alarmed by a rising number of drug-addicted babies. More than 900 were born the year before, nine times the amount in 2001, many of them hooked on the prescription opioids their mothers had taken.

Doctors told Williams part of the state's problem was a law that allowed clinicians to refuse to prescribe powerful narcotics only if they steered patients to an opioid-friendly doctor.

Williams' mission to repeal the law failed that year, after lobbying from the American Cancer Society Cancer Action Network and the Academy of Integrative Pain Management — opposition that surprised Williams since prescribing painkillers for cancer patients would have remained legal.

Both the academy and the cancer group have been active across the country, making the case that lawmakers should balance efforts to address the opioid crisis with the needs of chronic pain patients.

The society's annual ranks of about 200 lobbyists around the country opposed opioid restrictions even in some cases where they specifically exempted cancer patients.

The Cancer Action Network listed four major opioid makers who donated at least $100,000 in 2015 and five more who gave at least $25,000. Companies that offer such sums get one-on-one meetings with the group's leaders.

Purdue Pharma gives to both groups. The company said in a statement that it contributes to a range of advocates, including some with differing views on opioid policy.

As for Williams, he tried again last year to repeal Tennessee's opioid prescribing law — and succeeded, even though the cancer network still opposed the repeal. The extra year gave Williams and his cosponsor time to help educate their fellow lawmakers, he said.