People who buy heroin on the street don’t get warned that it may contain fentanyl, the potent opioid responsible for most overdose deaths in Maryland and nationwide.

But a thin strip, akin to a pregnancy test, could quickly and reliably tell them.

Those are the findings of researchers at Johns Hopkins and Brown universities, who went looking for a scientifically sound way to spot fentanyl in powder or pills so people could protect themselves by avoiding batches or reducing amounts they use. The researchers used a strip meant to test people’s urine for fentanyl.

“They don’t want to die,” said Susan Sherman, associate professor in the health, behavior and society department at Hopkins’ Bloomberg School of Public Health.

With strips, she said, “there is still a risk. But this is about giving users some information to make choices and reduce harm associated with use.”

Public health officials prefer that everyone with a substance use problem get treatment but have pursued stopgap measures such as distribution of the overdose remedy naloxone to stem a growing tide of deaths. In Maryland, 1,705 people who overdosed and died in the first nine months of 2017 had fentanyl in their systems, up 56 percent from a year earlier.

While the research shows the strips could work, it’s not clear whether they’ll prove useful. Drug users may not embrace them, they might cost too much or fail to identify fentanyl all the time, researchers and advocates say.

The message from public health departments from Baltimore to New York is that it’s safest to assume every batch contains fentanyl.

But some advocates already are handing out the strips through official and unofficial channels. The California Department of Public Health distributes them through almost a dozen needle exchange programs across the state. Advocates in New York give them out, while the New York City health department does not but said it was interested in the Hopkins-Brown research.

For now, Stephanie Buhle, a department spokeswoman, said, “We encourage people who use drugs to take precautions to reduce their risk of overdose, including: carrying naloxone, using with another person, using a small amount to test potency first and not mixing drugs.”

Fentanyl was involved in nearly half of New York’s overdose deaths in 2016. In Baltimore, fentanyl was involved in closer to three-quarters of the 574 overdose deaths in the first nine months of 2017.

Baltimore’s health department aggressively distributes naloxone and developed a text system to alert users to places where fentanyl is likely being sold so they could avoid it. Dr. Leana S. Wen, health commissioner, sees potential in deploying strips.

“In principle we support the idea of drug checking, but in practice it’s a complex issue and the last thing we want is people thinking testing is the answer,” Wen said. “We really need to assume it’s fentanyl. … But testing could amplify the message to take precautions.”

The department plans to use the strips as they were intended, for urine tests, in a pilot at Mercy Medical Center and the University of Maryland Medical Center Midtown Campus. The department bought 3,500 strips, costing $1 each, to test overdose survivors with strips in the emergency room. It wants to gauge changes in providers’ and users’ behavior if they learn fentanyl was indeed responsible.

The idea for checking drugs with strips came from a so-called safe injection site in Vancouver, Canada, researchers and advocates believe.

The Hopkins-Brown study is probably the first to check the strips’ accuracy and adoptability, said the researchers, who partnered with the Bloomberg American Health Initiative’s public health solutions program.

There are still barriers. This is an “off-label” use of the strips — one not approved by the U.S. Food and Drug Administration. To test a drug for fentanyl, a sample would be mixed with water and the strip would display two stripes for fentanyl and one stripe for none.

Public health officials could be put in legal jeopardy if users rely on inaccurate results. They also could be handling illegal drugs that they help test.

Researchers said the strips do appear reliable, outperforming electronic versions by accurately detecting even tiny amounts of the drug, according to the study, which has not yet been submitted for publication in a scientific journal.

There also seemed to be interest when researchers asked hundreds of users about using strips. Few said they would abandon drugs with fentanyl, but three-quarters said they would change their behavior, such as using less initially.

Another drawback is that the strips only detect fentanyl and three chemical variations, while law enforcement officials say illegal labs constantly churn out new formulations. Strips also can’t detect other dangerous substances.

The researchers hope to spur some pilot projects in cities around the country to assess the strips’ usefulness.

Tino Fuentes, a former heroin users turned advocate and consultant, believes they will become widely used. After he began buying strips about a year ago and handing them out in the New York area, he began getting calls from people requesting more.

He said people tell him they are fearful of fentanyl, though he said a small number seek it for a stronger high. He does bring up treatment with those who are receptive but said for now most just want to avoid overdose.

“This is not a solution to the problem and will not stop drug use, but what they will do is help change user patterns and keep people alive,” Fuentes said. “Overdoses are getting more frequent, so we need new thinking of ways to stop them. Anything to keep them alive.”