A federal appeals court in Boston on Tuesday upheld a decision requiring the Aroostook County Jail to provide an opiate treatment drug to a Madawaska woman while she serves her 40-day jail sentence there.

A three-judge panel affirmed there was no error when U.S. District Judge Nancy Torreson ruled in March that prohibiting Brenda Smith, 35, from receiving her twice-daily dose of buprenorphine, an opiate replacement drug that she has been taking for the last decade to treat substance use disorder, violates the Americans with Disabilities Act.

Torreson issued a preliminary injunction ordering the jail to administer the medication as prescribed, despite objections from the county, which argued that buprenorphine, also known by the brand name Suboxone, is coveted contraband in jails for the euphoric effects it produces, and noted that inmates and others attempt to smuggle the drug into the jails, sometimes by mail or by concealing the sublingual strips as other items in an attempt to evade detection.

Following the injunction, attorneys for the county and sheriff asked the appeals court to stay the decision, but that request was denied. The brief, four-page ruling by the three-judge panel found no abuse of discretion by the lower court. The appeal drew 19 amicus briefs on Smith’s behalf, including from medical associations in New Hampshire, Vermont, and Rhode Island, and from groups that research and advocate for addiction treatment.

At her hearing in February, Smith testified that she had not relapsed in the last five years, and the drug allowed her to feel normal, live a functional life and take care of her kids. Her doctor also said that stopping her treatment suddenly would cause immediate withdrawal and could increase the risk to her health or her life in the future.

“I don’t want to lose everything I’ve worked so hard to achieve,” Smith said during testimony in U.S. District Court in Portland.

The ACLU of Maine argued the case on Smith’s behalf, and drew attention as a precedent-setting example of how state institutions have been forced to deal with the fallout of the national opiate addiction epidemic. While most county jails in the state have prohibitions on medication-assisted drug treatment, attitudes have begun to shift in light of the hundreds of deaths caused each year by drug overdoses.

Maine saw 418 drug overdose deaths in 2017 and a projected 376 deaths in 2018. Improving access to medication-assisted treatment in the correctional system is one of the goals of Democratic Gov. Janet Mills, and her administration already has started examining ways to improve access in the state prisons.