Willey was housed there from April 2004, when he was 18, to October 2006, court papers show.
The decision comes amid greater scrutiny of the treatment of inmates, including at the Rikers Island jail in New York City.
A spokesman for New York Attorney General Eric Schneiderman, whose office defended the Wende officials, declined to comment.
Willey said prison officials subjected him to physical and psychological harassment because he refused to provide false information about another inmate suspected of drug smuggling.
He said he was forced to spend more than six weeks behind a Plexiglas shield, which restricted airflow in a cell with a broken toilet. Willey, according to the judge's decision, alleged, was "reduced to breathing a miasma of his own accumulating waste."
Later, he spent two weeks in another unsanitary cell where he was kept naked. Willey said such treatment was a factor in his attempt at suicide.
The officials disputed many of the claims. A federal judge in Rochester, New York ruled for them, saying the exact length of Willey's exposures was unclear, and that he did not claim he was made ill or that waste overflowed from the toilet.
Writing for the appeals court, though, Chief Judge Robert Katzmann said no minimum duration or "level of grotesquerie" is required before unsanitary confinement conditions can violate the Eighth Amendment ban against cruel and unusual punishment.
He also said that the exposure's "qualitative offense to a prisoner's dignity should be given due consideration."
The appeals court also revived several of Willey's other claims, and returned the case to the lower court.
Timothy Hoover, a lawyer for Willey, said the decision shows "the key role that federal courts have in overseeing prisoner litigation claims related to confinement conditions, due process rights and treatment by corrections authorities."
The case is Willey v Kirkpatrick et al, 2nd U.S. Circuit Court of Appeals, No. 13-699.
Al Jazeera and Reuters
Error
Sorry, your comment was not saved due to a technical problem. Please try again later or using a different browser.