Appeal, by permission of a Justice of the Appellate Division of the Supreme Court in the Fourth Judicial Department, from an order of the Supreme Court, Erie County (Penny M. Wolfgang, J.), entered June 9, 2005. The order denied in part defendant’s motion pursuant to CPL 440.10 to vacate the judgment convicting defendant of criminal sale of a controlled substance in the second degree and attempted criminal sale of a controlled substance in the first degree.
*1176It is hereby ordered that the order so appealed from be and the same hereby is unanimously modified on the law by granting the motion in its entirety and vacating the judgment of conviction and as modified the order is affirmed, and the matter is remitted to Supreme Court, Erie County, for further proceedings on the indictment.
Memorandum: Defendant appeals from an order denying in part his motion pursuant to CPL 440.10 to vacate a 1989 judgment convicting him upon his plea of guilty of criminal sale of a controlled substance in the second degree (Penal Law § 220.41 [1]) and attempted criminal sale of a controlled substance in the first degree (§§ 110.00, 220.43 [1]). Contrary to the understanding of the parties and the court at the plea proceeding, attempted criminal sale of a controlled substance in the first degree is a class A-I felony rather than a class A-II felony (see § 110.05 [1]). Thus, Supreme Court properly concluded that the sentence of imprisonment of four years to life imposed on that count is illegal (see § 70.00 [3] [a] [i]; People v Gutierrez, 169 AD2d 882 [1991]). The court erred, however, in granting the motion only to the extent of vacating the sentence imposed on that count and permitting defendant to withdraw his plea of guilty on that count. “Where the plea bargain includes a sentence which is illegal because the minimum imposed is less than that required by law, . . . the proper remedy is to vacate the sentence and afford . . . defendant, having been denied the benefit of the bargain, the opportunity to withdraw the plea” (People v Martin, 278 AD2d 743, 744 [2000]). Further, “[inasmuch as the entire sentence is ‘part and parcel of the plea bargain,’ it must be vacated in its entirety regardless of whether portions of the sentence are legal” (People v Sheils, 288 AD2d 504, 505 [2001], lv denied 97 NY2d 733 [2002], quoting People v Sellers, 222 AD2d 941, 941 [1995]). We therefore modify the order by granting defendant’s motion in its entirety and vacating the judgment of conviction, and we remit the matter to Supreme Court for further proceedings on the indictment. In view of our determination, we do not address defendant’s remaining contentions. Present — Pigott, Jr., P.J., Scudder, Kehoe, Smith and Green, JJ.