Appeal by the defendant from a judgment of the Supreme Court, Queens County (Hirsch, J.), rendered July 12, 2012, convicting him of sexual abuse in the first degree and assault in the third degree, upon his plea of guilty, and imposing sentence.
Ordered that the judgment is reversed, on the law, the defendant’s plea of guilty is vacated, and the matter is remitted to Supreme Court, Queens County, for further proceedings on the indictment.
In order to be valid, a plea of guilty must be entered voluntarily, knowingly, and intelligently (see People v Mox, 20 NY3d 936, 938 [2012]; People v Hill, 9 NY3d 189, 191 [2007], cert denied 553 US 1048 [2008]; People v Robinson, 71 AD3d 1169, 1170 [2010]). “ ‘[W]here the defendant’s recitation of the facts underlying the crime pleaded to clearly casts significant doubt upon the defendant’s guilt or otherwise calls into question the voluntariness of the plea, . . . the trial court has a duty to inquire further to ensure [the] guilty plea is knowing and voluntary’ ” (People v Mox, 20 NY3d at 938, quoting People v Lopez, 71 NY2d 662, 666 [1988]; see People v Robinson, 71 AD3d at 1170).
*1016Here, in light of the defendant’s known history of mental illness, and the finding within six days after commission of the instant sex offense that the defendant was suffering from psychotic symptoms attributable to bipolar disorder, for which he required hospitalization, certain statements made during the defendant’s plea allocution — specifically, statements regarding the complainant’s impression that, at the time of incident, the defendant was “very very much mentally unwell” — “signaled that [the defendant] may have been suffering from a mental disease or defect” when the offense was committed, thereby triggering the Supreme Court’s duty to inquire (People v Mox, 20 NY3d at 939; see People v Robinson, 71 AD3d at 1169-1170; People v Bryant, 66 AD2d 786 [1978]; see generally People v Francis, 38 NY2d 150, 154 [1975]). The trial court’s failure to conduct any inquiry as to a potential affirmative defense to the charges based upon mental disease or defect (see Penal Law 40.15), requires vacatur of the defendant’s plea of guilty (see People v Mox, 20 NY3d at 939; People v Robinson, 71 AD3d at 1169-1170; People v Bryant, 66 AD2d at 786). While the People are correct that the defendant’s argument is unpreserved for appellate review, preservation is not required where, as here, under the totality of the circumstances, the defendant’s guilt and the voluntariness of the plea were called into question before the court (see People v Mox, 20 NY3d at 938; People v Lopez, 71 NY2d at 666; People v Robinson, 71 AD3d at 1169-1170).
The parties’ remaining contentions either are without merit or need not be reached in light of our determination.
Accordingly, the defendant’s plea of guilty must be vacated, and the matter remitted to the Supreme Court, Queens County, for further proceedings on the indictment. Skelos, J.P., Angiolillo, Dickerson and Roman, JJ., concur.