In October 2004, Julie Amero, a substitute teacher in Norwich, Connecticut, was teaching a seventh grade language class. While Amero was using a laptop computer—one accessible to both students and teacher—the computer began spinning off pop-up ads for pornographic websites. Amero concedes she was checking her email and surfing the Internet while she was supposed to be teaching. Perhaps that makes her a bad substitute teacher (though she had taught at the school for a year and a half without incident). But it doesn’t make her a sex offender.

Yet in January 2007 Amero was convicted on four counts on the ambiguous charge of "risk of injury to a minor, or impairing the morals of a child." Her ridiculous prosecution is the product of a Puritanical, zero tolerance hysteria; stubborn, obstinate police and prosecutors; and a criminal justice system that hasn’t adequately adapted to modern technology.

Prosecutors in the case improbably contended that Amero—who had no prior criminal record and was seven months pregnant at the time—intentionally exposed her class of seventh-graders to Internet pornography. She faced up to 40 years in prison.

Even if Amero had knowingly and willingly exposed her middle school class to pornography, she should at worst have lost her job, and perhaps faced a fine and revocation of her teaching license. That she could have spent most of the rest of her life in prison says she was either over-charged, or was charged with a ridiculously stupid law. Probably both.

But Amero insists she never intended for her class to be an Internet-abetted lesson in sex education, and there’s plenty of reason to believe her. She says she panicked when a loop of unwanted pop-up ads from porn sites began to appear while she was using the computer in front of her students. The more Amero frantically tried to close the ads, the more they kept springing up—a problem not at all uncommon on computers lacking up-to-date firewalls and virus protection.

What’s particularly troubling about Amero’s case isn’t necessarily the technical ignorance of the police and prosecutors—though that's troubling enough—but the fact that their ignorance seems almost willful. The state pointed out at trial that the school had put filtering software on its computers. But the school had also let the licenses for that software expire. It would have taken no more than a phone call with the Best Buy "Geek Squad" to learn that if filtering software isn’t updated, it's quickly rendered useless.

Early last year, after her conviction, Amero’s case caught fire on tech blogs and Internet message boards. Computer security experts across the country quickly recognized what had happened: Amero’s computer had been infected with malware, invasive software that can take control of a computer, often redirecting web browsers to porn sites. Police and prosecutors conceded that they hadn’t even bothered to test the computer for malicious software. Dozens of tech gurus volunteered to help with Amero’s defense. When they were finally able to examine her computer, they found what they suspected—it was infested with malware.

But it gets worse. The state’s expert witness, a computer crimes investigator with the Norwich Police Department, testified that because the URLs for the offending sites were "highlighted," Amero must have deliberately clicked on them. State’s Attorney David Smith took it a step further. He told jurors that Amero actually would have had to type the URLs in for them to show up in the browser registry. Both assertions are flat wrong. Internet Explorer, the browser Amero was using at the time, requires neither a mouse click nor a typed URL to show that a link has been visited. Any address loaded by the browser will show up as "visited," even those uploaded in a pop-up window. Many of the porn addresses were hidden behind innocuous-sounding URLs, some disguised as hair styling sites. Amero would had to have been pretty determined in her mission to expose seventh graders to porn to memorize and deliberately key in sites like http://pagead2.googlesyndication.com, one of the offending porn sites.

None of this mattered to cops, prosecutors, or the media. Children had seen adult naughty bits, and someone had to pay. Amero was made a pariah. Local newspaper the Norwich Bulletin ran an editorial lauding Amero’s conviction, declaring that her “intent was apparent” and "her deeds were disgusting."

But just in case Amero's lawyers did make a convincing case she didn't mean to upload the porn sites, Amero’s prosecutors had a fall-back plan: They argued that Amero should have taken measures to block students from seeing the computer once the images started loading.

Once computer experts proved the existence of malware, however, and showed the registry testimony to be flat wrong, the “well, she should have done something” defense was all the state had left, and it's the case they pushed in the media. Fox News’ Bill O’Reilly made that argument when he took up the case on his show, insisting that Amero should have turned off the computer. The Norwich Bulletin ran another editorial saying Amero should have "taped some paper over the screen." Prosecutors said at trial that Amero should have thrown a sweater over the screen.

But computer experts say Amero’s panicked reaction—to try and close the ads instead of turning off the computer—isn’t at all uncommon. At least one student testified that Amero did try to prevent him from seeing the images by physically pushing his face away from the screen. She also told a member of the school's staff about the problem. As a substitute teacher, Amero also didn’t have a password to access the computer. The teacher who specifically logged her on told her not to turn off the computer, or she and her students would be locked out for the rest of the day.

Perhaps Amero did show bad judgment in leaving the computer on. But should that be a felony? These prosecutors were ready to ruin Amero’s life by convicting her of a reputation-destroying sex crime—and possibly sending her to prison—because in their judgment, she didn’t properly react to the consequences of the school’s failure to keep its security software up to date. At worst, Amero is guilty of not knowing much about computers. And if that’s a crime, Norwich ought to also lock up its cops, prosecutors, and the editorial board of its local newspaper. Because they’re clearly just as ignorant about technology as Amero.

It wasn’t until earlier this month, four years after the incident, that the state of Connecticut finally dropped the four felony counts against Julie Amero. But it’s something of a Pyrrhic victory. In exchange for dropping the felony charges, Amero still had to plead guilty to a misdemeanor, pay a $100 fine, and forgo her teaching license in Connecticut. It’s hard to blame her for taking the deal, even if she’s innocent. The last four years have taken a toll on her health. Amero has been hospitalized from stress and a heart condition brought on by her case.

Incredibly, some public officials in Connecticut not only refuse to admit any error, they’re still making their case in public. The same day the plea deal was announced, New London County State's Attorney Michael Regan told Hartford Courant columnist Rick Green that he’s still convinced Amero is guilty, and was prepared to go to trial again. "I have no regrets,” he said. “Things took a course that was unplanned... For some reason this case caught the media's attention.”

Amero's case offers more evidence that the criminal justice system hasn't adequately adapted to a generation's worth of technological advances. Our courts are in bad need of some significant reforms, particularly when it comes to expert testimony. It’s one thing to have two competent, qualified experts arguing over evidence that can be interpreted in several ways. It’s something else to allow jurors to consider evidence that’s objectively, provably false. That’s particularly true when it comes from the prosecution's expert witnesses, whom jurors often give more deference to because they’re seen less as hired guns, and more as objective public servants.

Here, a clueless "computer crimes investigator" was permitted to give clearly erroneous testimony in a felony trial. Jurors were instructed to give that expert equal consideration to Amero’s own expert witness, who actually knew what he was talking about. It makes you ponder how many other local police departments have a resident "computer guy" who regularly testifies in criminal trials—and is in way over his head.

The solution is to work peer review, redundancy, and double-checking into the process of admitting forensic evidence at trial. Had three or four actual tech experts had the opportunity to review the conclusions of the Norwich PD's computer “expert,” they would have quickly seen his errors and recognized the symptoms of a malware infestation—just as they did when the case hit the Internet. The crucial difference is that they would have noticed all of this before Amero was charged and convicted, not after.

The very foundation of scientific inquiry is rooted in the peer-review process. It’s really an inexcusable failure that we haven’t yet found a way to utilize peer review to ensure the accuracy and integrity of the scientific evidence admitted in criminal cases—particularly given what's at stake.

Radley Balko is a senior editor at reason.