The vast majority of overdose deaths in Massachusetts in the first six months of 2014 were caused by heroin or a prescription opioid taken along with some other drug or alcohol, according to NPR.

Heroin was involved in 39 percent of the state’s 501 overdose deaths during that period, following by other opioids (37 percent) and the synthetic opiate fentanyl (37 percent). Cocaine was cited in 23 percent of cases, alcohol was involved in 19 percent, and benzodiazepines such as Klonopin and Xanax were involved in 13 percent.

Fentanyl was involved in many multi-drug deaths. Fentanyl is especially deadly when combined with heroin or other opioids. Alcohol, cocaine and other prescription medications were all implicated, but to a lesser extent, according to an analysis by the Harvard T.H. Chan School of Public Health.

Doctors treating patients in recovery say it is difficult to figure out what to prescribe for anxiety or depression. They note for a person on methadone, using benzodiazepines can trigger severe adverse reactions. Methadone and benzodiazepines both can suppress breathing.

In light of the findings about overdose deaths in Massachusetts, officials are urging doctors to be more careful about what they prescribe. Dr. Jim O’Connell, President of the Boston Health Care for the Homeless Program, asks patients which pills are popular on the streets and tries to avoid prescribing them.

“We, as doctors, don’t really have a good sense of what we should be prescribing, what we shouldn’t,” O’Connell said. “It’s really the combination of other drugs that is going to be the battle down the line.”