Fentanyl, a powerful drug responsible for killing more than 300 Californians in 2017, may have spiked in popularity because it’s cheaper to produce than heroin, not necessarily because drug users prefer it, according to a new UCSF report.

Researchers at UCSF found that street drug dealers and drug users don’t usually know that they’re selling or consuming fentanyl because it gets mixed into other drugs before it reaches the streets.

“Policies that target low-level dealers who often don’t know that they’re selling fentanyl won’t have any impact on the current fentanyl poisoning epidemic,” Sarah Mars, lead author on the study, said. “They might be the most visible but they’re not responsible for the fentanyl adulteration.”

The synthetic opiate can be found in anesthesia and pain relief drugs in hospitals, but becomes dangerous when laced in heroin, cocaine, methamphetamine and Xanax.

Mars, a qualitative project director at UCSF, clarified that the demand for fentanyl in the heroin supply comes from the wholesale suppliers up the chain, not the consumers. Although some drug users like the effects of fentanyl, they can’t specifically request it from their drug dealers.

“The fact that they want it doesn’t make any difference in the supply. They can’t buy fentanyl as fentanyl,” Mars said.

In the report published Tuesday, researchers found that prior to the current fentanyl wave that started in 2013, a number of factors coincided to create a shortage in the heroin supply that fentanyl could fill: a lull in the opium supply to the U.S., which is used to make heroin, a spike in the price of heroin, an increase in illicit drug users as a result of the opioid pill epidemic and a falling availability in prescription opioid pills.

Fentanyl is completely synthetic, as opposed to heroin, which comes from the opium poppy plant. Because of that, environmental fluctuations don’t affect its production. Fentanyl is also much more powerful than heroin and cheaper to create.

The dangers in fentanyl, Mars said, come when users don’t know how much of or how strong the strain is in their own dosage.

“The potency of fentanyl is not in itself a problem. The problem comes when there are fluctuations in the potency in the street supply and when users don’t know that fentanyl is present or how much is present,” she said.

California had 373 fentanyl overdoses in 2017, the highest number of fentanyl-related deaths since the state’s department of public health began tracking them in 2008.

In the Bay Area, San Francisco, Santa Clara and Contra Costa counties saw the highest numbers of fentanyl deaths. San Francisco and Contra Costa counties each reported 26 deaths, and Santa Clara reported 24, according to state data.

In San Francisco, about a fifth of the opioid overdose deaths — 22 out of 105 — were attributed to fentanyl in 2016, the last year for which data are available. The number of fentanyl deaths doubled from 11 in 2015 to 22 in 2016.

Ashley McBride is a San Francisco Chronicle staff writer. Email: ashley.mcbride@sfchronicle.com Twitter: @ashleynmcb