BOSTON (AP) — Prosecutors moved to throw out more than 21,000 drug convictions on Tuesday, five years after a chemist at the state drug lab was caught tampering with evidence and falsifying tests.

The state’s highest court had ordered district attorneys in seven counties to produce lists by Tuesday indicating how many of approximately 24,000 cases involving Annie Dookhan they would be unable or unwilling to prosecute if the defendants were granted new trials.

The American Civil Liberties Union of Massachusetts said Tuesday night that 21,587 cases had been recommended for dismissal. It said that would be the largest dismissal of criminal convictions in U.S. history.

The cases would be formally dismissed by court action, expected Thursday, the ACLU said.

“Today is a major victory for justice and fairness, and for thousands of people in the commonwealth who were unfairly convicted of drug offenses,” Matthew Segal, legal director of the ACLU of Massachusetts, said Tuesday in a statement.

Dookhan pleaded guilty in 2013 to obstruction of justice, perjury and tampering with evidence after being accused of falsifying her work as far back as 2004. She was sentenced to three years in prison and was paroled last year.

Many of the drug case defendants have already completed their sentences, though some probably remain in prison because of other charges not contaminated by the lab scandal. About 2,000 cases had been resolved before Tuesday.

Suffolk County District Attorney Daniel Conley, whose jurisdiction includes Boston, moved on Tuesday to dismiss all but 117 of the approximately 7,500 suspect cases there. The remaining cases, he said, involve people with a history of violent crime and probation violations.

Cape and Islands District Attorney Michael O’Keefe moved for dismissal of more than 1,000 cases. Bristol County District Attorney Thomas Quinn said his office is seeking to throw out more than 1,500.

Middlesex District Attorney Marian Ryan said there are nine cases her office would prosecute again if a motion for a new trial were granted.

Also affected were thousands of cases in Essex, Plymouth and Norfolk counties.

While it’s unknown how many cases Dookhan falsified, her conduct cast a cloud over the many thousands she worked on. As a result, in January, Massachusetts’ Supreme Judicial Court said prosecutors would have to show that they could retry these cases without relying on evidence handled by Dookhan.

Prosecutors said Dookhan admitted testing only a fraction of a batch of samples, then listing them all as positive for illegal drugs. Her motive, they said, was to boost her productivity and burnish her reputation.

For those who have completed their sentences, wiping away their convictions will help them in other ways, such as employment, housing or immigration status, said Daniel Marx, an attorney who argued for the dismissals.

“Now, a majority of these wrongfully convicted individuals will have the opportunity to clear their records and move on with their lives,” he said.

Anthony Benedetti, chief counsel of the Committee for Public Counsel Services, said some of the defendants lost their jobs or homes and some have been deported.

“In many respects the damage has been done,” Benedetti said. “Justice delayed is justice denied.”

___

Associated Press writer Steve LeBlanc contributed to this report.

(© Copyright 2017 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)