BOSTON – Prosecutors are beginning to figure out how to deal with thousands of drug cases handled by a chemist who is accused of mishandling drug samples and tainting evidence.

State police shut down the lab late last month after discovering that a chemist had failed to follow testing protocols and may have purposely mishandled evidence.

Officials have since produced massive lists of the chemist’s cases covering 34,000 defendants and more than 60,000 drug samples.

Prosecutors are now contacting attorneys for defendants in cases where Annie Dookhan was the primary chemist, starting with people who are already serving prison terms.

Attorney Rosemary Scapicchio said an assistant district attorney from Norfolk County told her Friday that prosecutors plan to bring her client, a man serving a 10-year sentence for cocaine trafficking, into court next week for a hearing that could lead to his release on bail.

Scapicchio said she was told that prosecutors will agree to release some defendants on bail or put their sentences on hold pending a motion for a new trial while they figure out the extent of Dookhan’s actions in individual cases.

“I applaud them for doing this,” Scapicchio said. “The right thing to do is to get them out (of prison) as quickly as you can, and then we can fight about what ultimately happens to the case.”

“They are recognizing it as a significant problem and a serious violation of constitutional rights,” she said.

David Traub, a spokesman for Norfolk District Attorney Michael Morrissey, said prosecutors have aggressively sought out defense attorneys in cases in which Dookhan was the chemist.

“At that point, it’s up to them to pursue their clients’ interests,” Traub said.

“We’re telling them we are going to look at it on a case-by-case basis, and in certain cases, we are going to assent to bail.”

Gov. Deval Patrick said Friday a team of state officials and prosecutors had begun an attempt to match the names associated with each of the drug samples tested by Dookhan with criminal prosecutions.

Patrick said officials would be “triaging” the list to determine which individuals may be serving prison sentences based on the tainted tests.

When asked if the process may result in the release of some inmates, Patrick responded: “I don’t know the answer to that. I can tell you whatever it takes to see that justice is done is what everyone is committed to.”