It looked like Fox News reporter Jana Winter might face jail time for refusing to reveal her sources related to the Aurora, Colo., theater shooting. But Christopher Handman of Hogan Lovells turned the case around this week, winning a ruling that’s being hailed as a milestone for press freedom.

In a 4-3 decision issued on Tuesday, the New York Court of Appeals shot down a Colorado subpoena that would have required Winter to reveal confidential sources for her reporting on the shooting. The four-judge majority concluded that “directing a [New York–based] reporter to appear in another state where, as here, there is a substantial likelihood that she will be compelled to identify sources who have been promised confidentiality, would offend our strong public policy—a common law, statutory and constitutional tradition that has played a significant role in this state becoming a media capital of the country if not the world.”

Winter has said that she was prepared to defy the subpoena even if that meant going to jail for contempt of court. Winter’s worst-case scenario wasn’t far-fetched. Prior to this week, every single court had ruled against her and upheld the subpoena.

“This is a landmark ruling,” said Handman. “If the court went the other way, New York’s shield law would have only protected reporters who work on the metro desk.”

The saga began back in the summer of 2012, when Winter began reporting on the mass shooting that had just taken place in Aurora at a screening of the latest Batman movie. Before the crime, gunman James Holmes had sent a notebook to a psychiatrist that reportedly featured violent musings and drawings. The judge overseeing the murder case ordered the prosecution not to divulge the incriminating contents of the notebook to the press. And yet, in July 2012, Winter reported on the notebook, citing information provided by two anonymous law enforcement sources.

Under Colorado’s shield law for journalists, reporters deemed to be “necessary and material” witnesses can be compelled to testify. Holmes’ defense lawyers subpoenaed Winter, persuading the judge overseeing the murder case that her testimony was necessary in order to get to the bottom of the apparent gag order violation. Before Winter could be dragged into Colorado, however, a judge in her home state of New York needed to sign off on the subpoena. Unlike Colorado, New York has an unqualified shield law for journalists. In other words, under no circumstances can a New York judge compel a New York reporter to divulge confidential sources.

New York Supreme Court Justice Larry Stephen in Manhattan signed the subpoena in 2012, determining that New York’s shield law doesn’t do Winter any good in a Colorado proceeding. In Stephen’s view, the only issue he could consider is whether the Colorado judge correctly concluded that Winter’s testimony is necessary to resolve the leak.

Up until that point, the head of Hogan Lovells’ media group, Dori Ann Hanswirth, had represented Winter in court. But when it became clear that Winter would need an appellate reversal, Hanswirth turned to Handman, a full-time appellate lawyer. Handman suffered a major setback in August 2013, when New York’s intermediate appeals court upheld Stephen’s certification of the subpoena by a 3-2 vote. That ruling set the stage for a Nov. 12 oral argument at the New York Court of Appeals, the highest court in the state. New York lawyer Daniel Arshack of Arshack Hajek & Lehrman made the case for the Holmes’ defense.

The text of New York’s shield law was silent on whether it should apply in circumstances like Winter’s, and there weren’t many relevant cases on point, so Handman and Arshack were basically arguing about fairness. “We thought we had the better of the argument when it came to public policy,” Handman explained. “Much of our brief emphasized the lineage of New York public policy. We had to show that there was this definite and strong policy at stake, and that the shield law isn’t something a recent vintage.”

That argument hit home. The court’s majority opinion notes that in 1734 a jury of New Yorkers refused to convict journalist John Peter Zenger, who refused the reveal sources used in articles critical of the colonial governor at the time. “In acknowledging the critical role that the press would play in our democratic society, New York became a hospitable environment for journalists,” the court wrote in Tuesday’s opinion.

Thanks to rulings like the one Handman secured on Tuesday, that hospitality remains in place three centuries later.