More than a year ago, the Department of Public Safety knew it had a problem. It discovered, purely by accident, that an analyst at its forensics lab in Houston had falsified the results of a drug test. DPS retested 100 of his cases and found two more errors. That was pretty bad. The lab technician, Jonathan Salvador, had worked there since 2006 and handled evidence from almost 5,000 cases from 36 Texas counties.

DPS suspended Salvador and sent a letter alerting prosecutors and district attorneys, and listing which of their cases Salvador had processed. “We believe it prudent to review his entire body of work,” the lab manager wrote in April 2012. “We are sorry for any inconvenience.”

They couldn’t know how sorry they’d be.

In June the Texas Court of Criminal Appeals overturned the conviction of Leroy Coty, who pleaded guilty to possession of more than 400 grams of cocaine in 2010 and was sentenced to 10 years in prison. Coty’s case was important because the Harris County district attorney had videotapes of Coty with drugs and other evidence that almost certainly could have convicted him without Salvador’s lab results. If any case was going to survive being handled by Salvador’s, it was Coty’s. It didn’t.

The first Salvador-tainted convictions overturned by the appeals court were those in which all the evidence was destroyed during testing. Since an estimated 25 to 50 percent of Salvador’s cases had no surviving evidence, prosecutors knew right away that they’d be freeing a lot of guilty people—and likely had jailed some innocent ones. Most DAs took steps to notify affected defendants and allocated resources to handle the coming waves of habeas corpus writs. Then they set about retesting any leftover evidence.

But in March the appeals court set a damning precedent by ruling that all evidence that had ever passed through Salvador’s custody was unreliable. That meant even if a DA could find enough surviving evidence to retest, the court still wouldn’t consider the new results valid because, for all it knew, Salvador spent his days swapping baggies of cocaine for Fun Dip.

Worse yet, the lab Salvador worked for knew he was doing a bad job for years. A DPS investigative commission found that Salvador was asked to correct mistakes in about a third of all the tests he ran. Periodic job evaluations noted that Salvador struggled with an “overall understanding of chemistry” and that his problems were “very systemic” and his work “right on the edge” of tolerable, though not “catastrophic.”

It could probably be described as catastrophic now. Twenty cases have been overturned so far, voiding almost 160 years of prison sentences. If all of Salvador’s cases are thrown out, which is looking more likely, the lost sentences will total more than 10,000 years.

In Walker County, DA David Weeks has already given up. His office tried to retest evidence from Salvador’s cases, but the “results were haphazard,” Weeks told the Hunstville Item. “In a case where [Salvador] said there was drugs, there wouldn’t be. And when he said there were no drugs, there were drugs.

“It’s clear that all the cases [Salvador] worked on are irreparably damaged,” Weeks said. He’s already making arrangements to expunge the records of every affected defendant. “It blew up in our faces.”