The Massachusetts Department of Correction has reached a settlement with prisoners' rights groups over its medical treatment of prison inmates with hepatitis C.

"When we sentence people to prison, we don't sentence them to a death sentence, which it would be if you're not treated for a life-threatening illness," said Jonathan Shapiro, an attorney with Shapiro, Weissberg and Garin, who represented the prisoners.

The settlement requires prisoners with the most serious cases of hepatitis C to be treated within 12 months. Prisoners with less serious cases will have to be treated within 18 months. Every new prisoner will be tested for hepatitis C, and those who have the disease will be treated.

Attorneys for the National Lawyers Guild and Prisoners' Legal Services filed a class action lawsuit in U.S. District Court in Boston in 2015 on behalf of prisoners who have hepatitis C.

The groups argued that the state had reduced the number of patients treated for hepatitis C and delayed evaluating patients in order to avoid being responsible for treatment. The delays came as new treatments for hepatitis C were coming on the market that were more effective but expensive.

Hepatitis C is prevalent among the prison population, primarily because it is spread through intravenous drug use. It is also spread through bodily fluids. The virus can remain dormant for years, but can result in severe liver problems and death if left untreated.

State documents in 2015 showed that around 1,500 state prisoners had hepatitis C, although not all of them needed treatment. Only three were being treated.

The settlement, which must still be approved by a judge, lays out protocols for testing and treating patients. Corrections officials will have to identify how many patients have different stages of the disease.

Going forward, all new inmates will be tested, and those who need treatment will be treated within nine or 12 months, depending on the severity of their illness. Inmates with less advanced stages of the disease will be retested every six months.

Corrections officials will not be allowed to deny treatment to an inmate based on their drug use, the amount of time they have left in prison, or for disciplinary infractions.

An independent monitor will ensure the Department of Correction is complying with the settlement.

The Department of Correction is also responsible for paying $270,000 in legal fees to the prisoners' rights groups.

The Department of Correction will have to treat prisoners with direct-acting antiviral drugs, which are seen as the standard of care for treating hepatitis C.

According to the settlement, approximately 280 prisoners are expected to fall into priority categories and require treatment within the next 18 months. In comparison, in the first three and a half years that these medications were on the market, the Department of Correction treated 130 patients, according to attorneys for the prisoners.

Shapiro said the cost of the drugs is approximately $30,000 to $50,000 for a full course of treatment - which is less than it was when the lawsuit was filed. Patients are generally given medication for two to three months.

Joel Thompson, an attorney with Prisoners' Legal Services and the lead attorney on the case, said these drugs have high cure rates, and treating prisoners in prison will lead to less transmission of the disease once prisoners are released, and lower health care costs and complications later on.

Thompson said someone in prison is sentenced to loss of liberty. "It shouldn't be the loss of liberty and substandard health care and liver cancer or cirrhosis," Thompson said.