By Philip Marcelo, Associated Press

BOSTON (AP) — Thousands of defendants convicted of drug crimes after a chemist in a state lab tampered with evidence can’t be charged with more serious crimes or given harsher sentences if granted a new trial, Massachusetts’ highest court ruled Monday.

But the Supreme Judicial Court stopped short of ordering the affected convictions vacated, which had been sought by the Committee for Public Counsel Services, which oversees public defenders in Massachusetts.

READ MORE: Body Of Missing Swimmer Recovered From Hyde Park Pond

Read The Ruling (PDF)

The state drug lab scandal erupted when chemist Annie Dookhan admitted she tampered with evidence at the William A. Hinton State Laboratory Institute in Boston, forcing the closure of the lab in 2012. Dookhan was sentenced in 2013 to at least three years in prison.

“Since the revelation of Dookhan’s egregious misconduct at the Hinton drug lab — a lapse of widespread magnitude in the criminal justice system — we have found it necessary to exercise our general superintendence power to ameliorate its damaging effects,” the justices wrote.

Matt Segal, legal director for the American Civil Liberties Union of Massachusetts, who argued the case before the court in January, called the ruling an “enormous victory” for due process.

“It’s through and through a victory,” he said Monday. “The most important thing was that these defendants now have a real and meaningful opportunity to challenge those convictions in court.”

The state Bar Association also applauded the ruling, which essentially caps a defendant’s punishment at what it was under the original plea deal with prosecutors. “To find otherwise would have put a chilling effect on our justice system,” Martin Healy, the association’s chief operating officer, said in a statement.

But Suffolk County District Attorney Daniel Conley’s office, which argued against the ACLU’s case, called the ruling “lopsided.”

“These convicted defendants now have nothing to lose and everything to gain by withdrawing their evidence-based admissions of guilt,” Conley spokesman Jake Wark said in a statement. “It provides defendants who unequivocally admitted their guilt the ‘second bite at the proverbial apple’ that the high court was so careful to withhold from the Commonwealth.”

READ MORE: 'It's Really Disturbing': Harvard Student In Surfside, Florida Describes Scene Of Building Collapse

The ACLU and the Committee for Public Counsel Services had argued that the high court needed to take special measures to address criminal cases affected by Dookhan’s misconduct.

They said many defendants feared seeking a new trial because, under state law, they could be prosecuted for crimes that had been dropped.

But lawyers for the district attorney’s offices in Suffolk and Essex counties opposed the ACLU’s request, disputing the argument that prosecutors would seek to “punish” defendants who seek new trials by seeking harsher sentences.

The justices deemed that exposing the defendants to their original, pre-plea deal charges would be inappropriate, given the circumstances.

“Were it not for Dookhan’s actions, defendants would not be in the position of having to seek postconviction relief from her malfeasance in the first instance,” the justices wrote.

Segal, of the ACLU, says the decision is significant because the majority of defendants have already completed their prison sentences. A number would now likely seek to have their cases retried to clear their criminal record, he said.

“That’s why this fear was so acute for them,” Segal said. “They’re trying to move on with their lives and they were being told, until today, that if you tried to seek a new trial, you could actually be sent back to prison.”

The ACLU has estimated over 40,000 convictions are linked with the drug lab scandal. Prosecutors have suggested the number that would ultimately seek to have their convictions overturned is far lower, however.

The case — Kevin Bridgeman vs. District Attorney for the Suffolk District — centered on three men who had pleaded guilty to drug-related charges based on evidence tested and potentially tainted by Dookhan.

MORE NEWS: 'Our Roads Need Attention Now': Attleboro Official Says State Can't Afford 2 Month Sales Tax Holiday

Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.