The Massachusetts Department of Correction will allow some prisoners to continue taking addiction medication, after a lawsuit alleging that state prison policies limit the treatment's use.

The suit, filed on behalf of three men who are currently incarcerated in state prisons, alleges that DOC officials limit access to the addiction medication buprenorphine, which the men take to treat their opioid use disorder.Both sides agreed in a hearing in Boston federal court Monday that two of the men could continue taking buprenorphine. The third man — whose medication was stopped because he moved to a prison that doesn't provide it — will be evaluated to possibly be transferred back to the prison that does offer it.

Judge Indira Talwani declined to issue an order in the case, saying she preferred both sides reach an agreement.

"My preference is not to weigh in on the issues in this suit," she said.

The suit, filed by the American Civil Liberties Union of Massachusetts and the law firm Goodwin Procter, alleges DOC's policy limits the use of buprenorphine to the first 90 days after someone is incarcerated, and resumes its use shortly before someone is released.

DOC Deputy General Counsel Philip Silva said that medication decisions are made by clinicians with the department's medical provider, Wellpath. But Talwani questioned that.

"You've filed documents which suggest that decision making is in the hands of the medical provider," Talwani told Silva. "At the same time, DOC documents are not consistent with that and suggest there is a 90-day DOC limit on the medication."

To facilitate the agreement, Judge Talwani recessed the court so Silva could contact DOC officials and confirm that two men could continue taking buprenorphine at MCI Cedar Junction and that the third man could be evaluated at MCI Norfolk, which does not offer the medication, and possibly be transferred back to Cedar Junction.

"We are relieved that our clients will have access to medication while we continue to fight for their legal rights and personal safety," said ACLU attorney Jessie Rossman. "Opioid-use disorder is a medical issue and must be treated as such. This order will save our clients’ lives."

The suit comes as prisons and jails throughout the state and the country grapple with people who are incarcerated who also have a substance use disorder.

Currently, DOC offers buprenorphine at four state prisons, including one that is used primarily to house men who are civilly committed to addiction treatment. Seven Massachusetts jails started a pilot program this fall to offer three addiction medications, buprenorphine, methadone and naltrexone, to those incarcerated.

The ACLU has filed other lawsuits over addiction medication in jails and federal prisons and says it hopes to set legal precedents.

"This case, of course, is on behalf of our three plaintiffs but we certainly hope it encourages the Department of Correction to make sure everyone has access to their medication," Rossman said. "Addiction is a disease and we need to treat it as such."

Another hearing on the suit is scheduled for January.

This reports comes from the New England News Collaborative, eight public media companies including Rhode Island Public Radio, joining together to tell stories of a changing region, with support from the Corporation for Public Broadcasting.