AUGUSTA, Maine — A preliminary analysis of data compiled in the first half of 2015 shows deaths related to heroin and fentanyl in Maine are on the rise, while the overall number of drug overdose deaths is on track to be similar to 2014, which was the worst year on record, the state’s attorney general said Thursday.

A total of 105 people died from a drug overdose in the first six months of the year. Of that, 37 deaths were primarily attributable to heroin and 26 primarily to fentanyl, according to an analysis of case files conducted for the attorney general’s office by the state medical examiner’s office. Fentanyl is a powerful opioid pain medication.

In 2014, 208 people died of overdoses, 57 primarily attributable to heroin and 43 primarily attributable to fentanyl.

“These numbers are terribly distressing,” Attorney General Janet Mills said in a news release. “The first six months of 2015 show that this crisis continues unabated and we — everyone in the state of Maine — still have a great deal of work to do to get this under control. We need to address this crisis from all angles: education, prevention, treatment and interdiction.”

Two caveats underscore these statistics, Mills said.

Based on experience in past years, the actual total for a year can vary about 15 percent up or down from twice the amount of the half-year mark, Mills noted. Also, most toxicology reports reveal the decedent’s blood contained numerous substances — cocaine, alcohol, fentanyl, heroin and other opioids or over-the-counter medications. So one death can be caused by multiple substances.

“It cannot be stressed enough. You do not take heroin, it takes you,” Mills said.

According to the Maine Drug Enforcement Agency, heroin accounted for 32 percent of all arrests the agency made last year, Cmdr. Peter Arno, who oversees the northern half of the state, said last month.

The heroin is arriving in Maine from out-of-state dealers — primarily in Massachusetts, New York and Connecticut. Instead of selling to Mainers who would travel to those states, they have begun bringing the heroin to Maine themselves, “setting up shop” across the state, Arno said.

And unlike prescription opioids, such as OxyContin, there’s little quality control with heroin.

Often, heroin is diluted, or cut, with fentanyl, the most potent opioid available, 30 to 50 times more potent than heroin. Sometimes, Arno said, people end up buying pure fentanyl with no heroin in it without realizing it — dramatically increasing the risk of an overdose.

According to data released Tuesday by the U.S. Centers for Disease Control and Prevention, heroin overdose deaths nearly quadrupled in the U.S. from 2002 to 2013, the most recent year for which data are available.

The rate was stable from 2002 to 2006, then began to increase gradually through 2009. Then, “beginning in 2011, the overdose death rate increased sharply from 1.4 per 100,000 to 2.7 per 100,000 in 2013 — a 296 percent increase since 2002,” according to the CDC

Maine alone saw 57 overdose deaths from heroin in 2014, up from 34 the year before, Mills said in May. Those who died of heroin overdoses ranged in age from 18 to 88.

If you or someone you know needs help getting treatment, dial 211.

BDN writer Beth Brogan contributed to this report.