BOSTON — Two hairs that looked like the victim’s; some dirt on a truck like that taken from the crime scene; a pattern on the bumper that resembled a design on the victim’s popular brand of jeans. The case against Steven Barnes in the rape and murder of a 16-year-old girl seemed circumstantial, at best.

So the guilty verdict shocked him.

“I was saying, ‘This can’t be happening. You can’t convict somebody on similarities, perhaps or maybes,’” Barnes said.

He spent the next 20 years in prison before DNA testing exonerated him, becoming one of hundreds of people convicted in whole or in part on forensic science that has come under fire during the past decade.

Some of that science — analysis of bite marks, latent fingerprints, firearms identification, burn patterns in arson investigations, footwear patterns and tire treads — was once considered sound, but is now being denounced by some lawyers and scientists who say it has not been studied enough to prove its reliability and in some cases has led to wrongful convictions.

Even so, judges nationwide continue to admit such evidence regularly.

“Courts — unlike scientists — rely too heavily on precedent and not enough on the progress of science,” said Christopher Fabricant, director of strategic litigation for the Innocence Project. “At some point, we have to acknowledge that precedent has to be overruled by scientific reality.”

Defense lawyers and civil rights advocates say prosecutors and judges are slow to acknowledge that some forensic science methods are flawed because they are the very tools that have for decades helped win convictions. And such evidence can be persuasive for jurors, many of whom who have seen it used dramatically on “Law & Order” and “CSI.”

Rulings in the past year show judges are reluctant to rule against long-accepted evidence even when serious questions have been raised about its reliability:

•In Chicago, a federal judge rejected a request to exclude testimony of government experts to describe firearm and tool-mark comparisons they performed on bullets collected at crime scenes in the trial of Hobos gang members. The judge reasoned that defense lawyers were free to cross-examine the government’s experts.

•A judge in Pennsylvania ruled prosecutors can call an expert to testify about bite marks found on a murder victim’s body, despite 29 wrongful arrests and convictions nationwide attributed to unreliable bite mark evidence since 2000.

•A Connecticut judge allowed prosecutors to present evidence that a footprint was made by a specific shoe belonging to a man accused of murder, despite a 2016 finding by the President’s Council of Advisors on Science and Technology that such associations are “unsupported by any meaningful evidence or estimates of their accuracy.”

Two reports by scientific boards have sharply criticized the use of such forensic evidence and universities that teach it are moving away from visual analysis — essentially, eyeballing it — and toward more precise biometric tools.

But some defense lawyers fear any progress on strengthening forensic science may be lost under President Donald Trump.

In April, Attorney General Jeff Sessions announced the Justice Department would disband the National Commission on Forensic Science, an independent panel of scientists, researchers, judges and attorneys that had been studying how to improve forensic practices.

The National Registry of Exonerations at the University of California Irvine has documented more than 2,000 exonerations since 1989. Nearly one-fourth list “false or misleading forensic evidence” as a contributing factor.

And a report last fall from the President’s Council criticized several “feature-comparison” methods. The council said those methods — including analysis of shoeprints, tire tracks, latent fingerprints, firearms and spent ammunition — need more study to determine their reliability and error rates.

When the reliability of forensic evidence is challenged through DNA testing or other new evidence, it often results in the granting of a new trial, even if there is other strong evidence.

“More often than not, it undermines confidence in the verdict, which is enough to get a new trial,” said Daniel Medwed, a law professor at Boston’s Northeastern University.

Many prosecutors scoff at the notion that long-used forensic evidence is not scientifically valid, saying groups that have criticized the techniques were too heavily influenced by defense attorneys.

The National Commission on Forensic Science wants “to change the system from the ground up to make it virtually impossible to convict anybody,” said William Fitzpatrick, a prosecutor in Syracuse, N.Y.

Kirk Odom was 18 when he was charged with raping a woman at gunpoint in Washington, D.C. An FBI agent testified that a hair on the woman’s nightgown was “indistinguishable” from Odom’s.

Odom spent 22 years in prison but was exonerated after DNA testing of the hair and other evidence excluded him as the rapist.

“I just kept saying, ‘They’re lying,’” Odom recalled. “‘That ain’t my hair.’”