Appeal from a judgment of the County Court of Albany County (Harris, J.), rendered November 6, 1988, convicting defendant upon his plea of guilty of the crime of attempted criminal sale of a controlled substance in the first degree.
Contrary to defendant’s claims, the record shows that his plea of guilty was voluntarily and knowingly made (see, People v Lopez, 71 NY2d 662) and that he received effective assistance of counsel (see, People v Baldi, 54 NY2d 137). Nevertheless, County Court did err in its sentencing of defendant. Defendant’s plea of guilty to the crime of attempted criminal sale of a controlled substance in the first degree was misdescribed by all parties as a class A-II felony and his sentence to a prison term of five years to life was made on that basis. However, the crime to which he pleaded guilty is actually an A-I felony (see, Penal Law § 110.05 [1]), and a prison term of at least 15 years is mandated by statute (see, Penal Law § 70.00 [3]'[a] [i]). Since the sentence was illegal, defendant was denied the benefit of his plea bargain and he is therefore entitled to vacatur of the sentence imposed and he should be given the opportunity to withdraw his plea of guilty (see, People v Dunnett, 157 AD2d 886, lv denied 76 NY2d 734; People v Beach, 152 AD2d 772).
Judgment modified, on the law, by vacating the sentence imposed; matter remitted to the County Court of Albany County for further proceedings not inconsistent with this court’s decision; and, as so modified, affirmed. Mahoney, P. J., Weiss, Levine, Mercure and Harvey, JJ., concur.