Nearly 1,000 men and women in California prisons overdosed last year and required emergency medical attention in what officials acknowledge is part of an alarming spike in opioid use by those behind bars, according to records obtained by The Chronicle.

The number of inmates treated for drug or alcohol overdoses jumped from 469 to 997 from 2015 to 2018 — a 113% increase. While many of the prisoners survived, the most recent data available show drug-related inmate deaths are on the rise, too — from 17 in 2006 to 40 in 2017.

The rise in overdoses comes despite the state pouring millions into technologies designed to block contraband at prison entry points. But as powerful opioids such as fentanyl require smaller doses and become easier to smuggle, these efforts have proved futile in stopping the flow of drugs via visitors, prison employees, the mail and even drones.

“There are so many opportunities, so much money to be made, I don’t think there’s one single answer,” said Jody Lewen, founder of the Prison University Project, which teaches college courses at San Quentin State Prison. As long as there are human beings going in and out, there are going to be opportunities.”

Total overdoses surged across the California Department of Corrections and Rehabilitation’s 36 institutions, which hold more than 126,000 people. But a review of data provided by California Correctional Health Care Services shows the uptick was especially severe in a handful of places.

Incidents at San Quentin and Solano state prisons remained steady from 2017 to 2018, with 12 and eight overdoses each year, respectively. Meanwhile, Salinas Valley State Prison saw overdoses jump from 42 in 2017 to 100 last year; and at Richard J. Donovan Correctional Facility, a lockup in San Diego County, they ballooned from 32 to 83 over the same period.

“As is the case in society as a whole, California state prisons have experienced an unfortunate increase in drug overdoses and hospitalizations due to opioids in recent years,” corrections spokeswoman Vicky Waters said in a statement.

Prisons and their health care system are “committed to addressing this issue and are taking proactive steps to both reduce the introduction of contraband into our facilities and to provide increased treatment options for inmates with substance abuse disorders,” she said.

The trend in California’s prisons reflects the nationwide opioid epidemic. In 2017, 47,600 people died of opioid overdoses, compared with 42,249 in 2016, according to the Centers for Disease Control and Prevention.

In 2017, then-Gov. Jerry Brown funneled $15.3 million into a three-year program to curb smuggling. Last year’s budget included $9.1 million for a comprehensive interdiction pilot program at the California Substance Abuse Treatment Facility and State Prison in Corcoran (Kings County).

Efforts to block the infiltration of drugs in California prisons have included parcel scanners, low-dose, full-body scanners, metal detectors and drug-sniffing dogs, in addition to expanded rehabilitation services and addiction treatments. But drug-screening policies aren’t uniformly enforced on employees and visitors systemwide, and loopholes exist, said Joe Baumann, a recently retired corrections officer and former finance chairman of the guards union.

Dogs aren’t used 24 hours a day, and even low-dose scanners can’t detect drugs hidden in an orifice, said Baumann, who still consults for the union.

It’s common for prison visitors to hide a baggie of drugs in their bodies, remove it in a bathroom and give it to an inmate with a kiss, Baumann said. Others have been brazen enough to use tennis rackets to lob balls stuffed with drugs over prison fences. One elderly couple attempted to throw a football containing drugs over the fence of the California Rehabilitation Center in Norco (Riverside County) to help their son pay off a drug debt, but couldn’t make it over.

Baumann said the state would have to spend untold tax dollars to close the loopholes, and there’s no guarantee drugs wouldn’t find another way inside prison walls. He acknowledged that a few “dirty” staff members have contributed to the prison drug epidemic but said inmates often snitch on them or other inmates.

“Prison drug smuggling is absolutely the purest form of capitalism,” Baumann said.

Overdoses climbed to the fourth-leading cause of death among California prisoners in 2017, outpacing deaths from infectious diseases, suicide and homicide, and trailing cancer, cardiovascular disease and end-stage liver disease.

“It’s a really big problem,” said Donald Specter, executive director of the Berkeley nonprofit Prison Law Office, which provides free legal services to inmates. No one can pinpoint exactly why overdoses are rising so quickly, or if it’s because of more drugs coming into the prisons or more potent strains, he said.

State Sen. Nancy Skinner, D-Berkeley, chairwoman of the Senate Public Safety Committee, points to fentanyl, a synthetic opioid that is up to 100 times more potent than morphine.

“One of the horrible things about fentanyl is that it can be used in such tiny quantities that it’s so much harder to detect,” she said.

Last year in late April, 14 men incarcerated at Mule Creek State Prison in Amador County became sick on a substance later identified as fentanyl. One later died. An inmate suspected as the distributor was given a disciplinary infraction, and his case was turned over to the local district attorney’s office, Waters said.

Fentanyl has found its way into what is supposed to be one of the state’s most secure prison facilities, contributing to the deaths of at least four men on San Quentin’s Death Row in the past two years, according to autopsy reports.

Joe Abbott, 49, died of acute multiple illicit drug intoxication on Jan. 31, 2018. A toxicology report found both methamphetamine and fentanyl in his system. A few months earlier, on Nov. 2, 2017, 40-year-old condemned inmate Emilio Avalos died of acute fentanyl intoxication, according to his autopsy.

Convicted killers Herminio Serna, 53, and Joseph Perez Jr., 47, died just one day apart on Dec. 3 and 4, respectively. Officials cited unknown causes at the time. But an internal email obtained by The Chronicle on Dec. 5 showed that San Quentin officials called an emergency meeting to discuss a lethal strain of contraband inside the facility.

Autopsies concluded that both Serna and Perez died of acute drug intoxication, according to Marin County Chief Deputy Coroner Roger Fielding. Both men tested positive for fentanyl and other drugs. Investigations into those deaths are pending.

Skinner said this year’s state prison budget will focus more on the root cause of overdoses. “If we want to lessen the hospitalizations and the deaths,” she said, “we’ll need to be utilizing the substitutes, meaning medically assisted treatments.”

This can include methadone or other treatment drugs as well as counseling. Inmate advocates are pushing for this strategy over interdiction.

“In last year’s budget the prison system got some money to try to keep the drugs out of the prison, which is almost an impossible task,” Specter said. “We have to tackle the source of the problem, which is addiction.”

Megan Cassidy is a San Francisco Chronicle staff writer. Email: megan.cassidy@sfchronicle.com Twitter: @meganrcassidy