ANNAPOLIS, Md. — Maryland ranks 11th among states for the average number of lobbyists each year working for makers of prescription painkillers and allied groups, when drug makers’ lobbying hires are ranked using a ratio factoring in all lobbyist registrations in each state, a joint investigation by The Associated Press and the Center for Public Integrity has found.

Nationwide, companies that make prescription opioid painkillers and allied groups have spent more than $880 million from 2006 through 2015 on campaign contributions and lobbying over the past decade as they worked to influence state and federal policies, the investigation found. The companies and groups employed an annual average of 1,350 lobbyists in state capitals around the country and contributed to a total of 7,100 candidates for state-level office, according to the investigation.

The also hired more than 115 federal lobbying organizations each year during that 10-year period.

The groups have an array of political interests that include opioid advocacy, and their spending was eight times what the gun lobby spent during the same period. The overall picture of drug-related lobbying in Maryland in recent years has been complicated by robust interest the state’s efforts to get a stalled medical marijuana program off the ground.

Groups seeking limits on opioid prescribing spent about $4 million, by comparison nationwide.

Meanwhile, overdose deaths from prescription painkillers have soared since 2000, claiming the lives of 165,000 people in the U.S.

Here’s a look at how money and resources have been spent in Maryland and where the state ranks:

LOBBYISTS:

Since 2006, Maryland has had an average of 31 registered lobbyists each year employed by members of the Pain Care Forum, a coalition of companies and advocacy groups that meets to discuss opioid-related issues.

The number of lobbyists employed by the coalition has been on the rise in recent years, as Republican Gov. Larry Hogan has highlighted the magnitude of drug-related deaths in Maryland and legislation aimed at reducing opioid drug addiction has been passed by the Democrat-controlled General Assembly.

Last year, Hogan personalized the state’s drug problem by noting the loss of his own cousin to an overdose several years ago as he laid out plains to fight a problem he frequently heard state residents talk about while campaigning.

That year, 43 lobbyists were employed by members of the Pain Care Forum — the highest in the last decade in Maryland and an increase from 34 the year before. In 2009, only 17 lobbyists were employed by the coalition of companies in Maryland.

CONTRIBUTIONS:

State candidates and parties in Maryland have received at least $227,162 in contributions from PFC members since 2006. Maryland ranks 39th in proportion to overall contributions to state lawmakers.

PRESCRIPTIONS:

Maryland had more than 3.9 million opioid prescriptions in 2015. That puts its per capita rate that year at 0.66. Nationally, the per capita rate was 0.71 in 2015.

DEATHS:

There were 7,117 deaths from overdoses in Maryland from 2006 through 2014. The state’s death rate per 100,000 in 2014 was 17.9. The number of overdose deaths rose 40 percent from 2006 to 2014. The overdose deaths aren’t limited to opioids, but the Centers for Disease Control and Prevention has indicated that prescription opioids and heroin account for the majority of drug deaths.