A jury concluded Mr. Desormeau had done just that in 2014, when he claimed to have witnessed a man sell drugs to two women on a street corner in Jamaica, Queens.

According to Mr. Desormeau, after observing those two transactions, he and his partner got out of their unmarked car and stopped the man, Roosevelt McCoy, in front of a nearby Jamaican restaurant. Mr. Desormeau testified that he quickly recovered crack cocaine from behind Mr. McCoy’s waistband.

But surveillance videotape from the Jamaican restaurant showed Mr. McCoy shooting pool inside the restaurant when the detective said he was outside dealing drugs. The two detectives can be seen approaching Mr. McCoy inside the restaurant, bringing him outside and then searching him. On the video, they do not appear to find any contraband.

The case raised troubling questions about the prevalence of police perjury, particularly because a gun arrest which Mr. Desormeau and his partner made in Manhattan less than three months later became the subject of additional charges, including perjury. That case is pending.

The Times examined Mr. Desormeau’s career in an article in October. More recently The Times investigated the phenomenon of “testilying” within the New York Police Department in a series of articles.

On Wednesday, Justice Aloise criticized Mr. Desormeau for undermining his fellow officers, but did not address the broader issue of police perjury, other than to suggest that Mr. Desormeau’s actions could encourage a tendency to regard police testimony with undue skepticism. “It helps feed the false narrative that police officers are not to be trusted and their testimony is not to be believed,” Judge Aloise said.

Then Judge Aloise accused the prosecution of allowing Mr. McCoy, who was the main witness against Mr. Desormeau, to lie on the witness stand. Mr. Desormeau had said he found a rock of crack cocaine on Mr. McCoy, and testing indicated that the twist bag in which the crack was found contained DNA that matched Mr. McCoy’s sample.