One July morning in 2012, climate scientist Michael Mann woke up to a terse email from a fellow scientist.

“Holy crap,” read the message, from Phil Plait, an astronomer and science communicator. “This is truly the most awful thing I’ve ever seen said about a climate scientist. If someone wrote this about me, I’d be calling a lawyer.”

A conservative media outlet and a right-leaning research organization had published commentaries comparing Dr. Mann, then a professor at the Pennsylvania State University, with Jerry Sandusky, the onetime Penn State football coach convicted of sexually assaulting multiple children. The writers claimed that Dr. Mann had created fraudulent graphs, and accused the university of mishandling investigations into both the coach’s crimes and the scientist’s research.

Dr. Mann did indeed call a lawyer. He sued the writers and their publishers for libel and slander. Now, 12 years later — after a pinball journey through the obstacle course of free speech and defamation law — the case is being tried in District of Columbia Superior Court. Only the two writers as individuals are on trial. A verdict is expected as soon as Wednesday.

“For me to be compared to Jerry Sandusky, as the father of a 6-year-old girl, was maybe the worst thing that I’ve ever experienced,” Dr. Mann testified in court on Jan. 24. “I felt like a pariah in my own community.”

The court case has played out over a time period when outright denial of climate science has decreased, but scientists’ integrity has become a bigger target.