Town Court further failed to grapple with the defenses of constructive eviction and breach of the implied warranty of habitability raised by respondent. County Court correctly observed that these defenses cannot forestall an eviction in a holdover proceeding, but overlooked that they are viable "defense[s] to the recovery of rent" in such proceeding (Goethals Mobile Park v Staten Is. Meadowbrook Park Civic Assn., 208 AD2d 896, 897 [1994]; see Blumenthal v Chwast, 2003 NY Slip Op 50029[U], *4 [App Term 2003]). With regard to constructive eviction, respondent represented that the apartment was contaminated by mold that affected his health and, while he left his belongings there, he was personally unable to remain there as the result of the action by town officials barring him from using or occupying the premises. As such, additional inquiry was undoubtedly required as to whether petitioner's actions or inactions "substantially and materially deprive[d] [respondent] of the beneficial use and enjoyment of the premises" so as to constitute a constructive eviction (Barash v Pennsylvania Term. Real Estate Corp., 26 NY2d 77, 83 [1970]; see Bostany v Trump Org. LLC, 88 AD3d 553, 554 [2011]; Phoenix Garden Rest. v Chu, 202 AD2d 180, 180 [1994]). Further, "violation[s] of a housing, building or sanitation code" were found in the apartment and, if substantial, would "constitute[] prima facie evidence that the premises [were] not in habitable condition" (Park W. Mgt. Corp. v Mitchell, 47 NY2d 316, 327 [1979]; see Real Property Law § 235-b). Town Court expressed its skepticism as to the degree of damage to the apartment, and there were indications that respondent's own behavior prevented petitioner from repairing that damage. Nevertheless, Town Court erred in refusing to receive evidence on these defenses and determine whether either warranted an abatement in the amount of rent awarded to petitioner (see Park W. Mgt. Corp. v Mitchell, 47 NY2d at 329; Goethals Mobile Park v Staten Is. Meadowbrook Park Civic Assn., 208 AD2d at 898-899). McCarthy, J.P., Lynch, Clark and Pritzker, JJ., concur.