More than 54 million opioid pills were prescribed in Marin County from 2006 through 2012, according to a new study of federal data.

The study, produced by the Washington Post, offers a county-by-county look at the nation’s opioid crisis. The study analyzed 380 million prescription-drug transactions in a database maintained by the Drug Enforcement Administration.

The database follows the route of every prescription written during that time frame. The Post analyzed shipments of hydrocodone and oxycodone pills, which the report says account for three-quarters of the total opioid pill shipments to drug stores across the United States.

The numbers show more than 1.5 billion opioid pills being manufactured and distributed at Bay Area facilities in the seven-year period.

“This really tells the story of what helped drive the opioid epidemic regionally, Marin included,” said Dr. Matt Willis, Marin County’s public health officer. “Physicians were misled into believing that these drugs were more safe and more effective than they are, mainly by the companies that manufacture opioids.”

“We learned the hard way that the things we were doing routinely in medical practice, in opioid prescribing for all kinds of pain, was actually harming people in a lot of cases,” Willis said. “The wake up call was that we started seeing more overdose deaths related to prescribed opioids. In Marin we had one opioid related overdose every two weeks in 2014.”

The database documents 54,100,786 opioid pills prescribed in Marin over the seven-year span. That amounts to an average of 31.1 pills per person per year during the study period.

“One of our most important strategies to fight the opioid epidemic has been working with doctors to rethink how and when we prescribe opioids,” Willis said. “The good news is that Marin clinicians have taken real steps to change practice. The health department is tracking this closely, and we’ve had an approximately 50 percent reduction in opioid prescribing in Marin since 2014.”

The Post analyzed shipments of hydrocodone and oxycodone pills, which the report says account for three-quarters of the total opioid pill shipments to drug stores across the United States.

“The Post is making this data available at the county and state levels in order to help the public understand the impact of years of prescription pill shipments on their communities,” the newspaper said in a story published Thursday. The database is at wapo.st/2GoDKvE.

“The analysis shows that the volumes of the pills handled by the companies climbed as the epidemic surged, increasing 51 percent from 8.4 billion in 2006 to 12.6 billion in 2012,” the paper said.

The number of oxycodone and hydrocodone pills prescribed in other Bay Area counties from 2006-2012:

Alameda: 617,525,202 — or an average of 59.8 pills per person per year

Contra Costa: 228,369,490 — 31.9

Napa: 30,932,475 — 33

San Francisco: 127,684,111 — 23.1

San Mateo: 109,509,962 — 22.2

Santa Clara: 202,878,545 — 16.7

Santa Cruz: 64,935,255 – 36.2

Solano: 104,266,026 – 36.4

Sonoma: 129,436,246 — 39.2

The Marin Independent Journal contributed to this report.