Massachusetts' highest court has ruled that thousands of defendants convicted of drug crimes after a chemist in a state lab tampered with evidence can't be charged with a more serious crime or given a harsher sentence if they seek a new trial.

But the Supreme Judicial Court declined to vacate all convictions based on evidence tainted by chemist Annie Dookhan, who was sentenced in 2013 to at least three years in prison after pleading guilty to faking test results.

The court handed down the decision Monday.

It had heard arguments in the case in January from the Committee for Public Counsel Services, which oversees public defenders in Massachusetts, the American Civil Liberties Union and the district attorney's offices in Suffolk and Essex counties.