A federal appeals court in Manhattan ruled on Thursday that a man convicted of weapons possession should have been able to tell the jury that the main witness against him, a New York City police detective, had been found to have testified untruthfully in proceedings involving an unrelated gun case.

The conviction of the man, Lance White, in 2009 was overturned, and he was granted a new trial in the decision by a three-judge panel of the United States Court of Appeals for the Second Circuit, which cited the trial judge’s ruling on what the jury could hear and what it called another error by that judge.

The panel noted that the judge in the earlier case had “unequivocally discredited” portions of Detective Paul Herrmann’s testimony, even suggesting that he had “recanted certain aspects” and implying that he had lied in a criminal complaint.

“These credibility judgments are plainly probative of Herrmann’s veracity and could affect a jury’s determination as to his willingness to lie to secure a criminal conviction,” Judge Guido Calabresi wrote in a two-to-one majority opinion for the panel.