Appeal from a judgment of the County Court of Rensselaer County (McGrath, J.), rendered August 13, 2007, convicting defendant upon his plea of guilty of the crime of attempted criminal possession of a controlled substance in the fifth degree.
In satisfaction of a two-count indictment, defendant pleaded guilty to one count of attempted criminal possession of a controlled substance in the fifth degree, was sentenced to the agreed-upon term of two years in prison followed by one year of postrelease supervision and waived his right to appeal. Defendant now appeals, contending that the sentence imposed was illegal.
Preliminarily, defendant’s valid waiver of his right to appeal does not foreclose his present challenge to the legality of his sentence (see People v Dukes, 14 AD3d 732, 733 [2005], lv denied 4 NY3d 885 [2005]). Turning to the merits, although not entirely clear from the record, it appears that defendant had at least two prior felony convictions at the time of sentencing— one for assault in the second degree and one for attempted criminal sale of a controlled substance in the third degree. Defendant admitted both prior felony convictions, but the CPL 400.21 statement filed by the People referenced only the conviction for attempted criminal sale of a controlled substance in the third degree. As defendant correctly notes, it is not clear from the sentencing minutes which of the two prior felony convictions County Court utilized as the predicate felony in imposing sentence. The record does, however, reflect that County Court stated that it sentenced defendant as a second felony offender pursuant to Penal Law § 70.06.
Penal Law § 70.06 does not provide for the imposition of a *801determinate sentence; any sentence imposed thereunder must be an indeterminate sentence (see Penal Law § 70.06 [2], [3], [4]), with a maximum term of no less than three years and no more than four years and a minimum of one half of the maximum term. Having been convicted of a felony defined in Penal Law article 220, defendant was required to be sentenced in accordance with Penal Law § 70.70, which mandates that the sentence for either a felony drug offender or a second felony drug offender be a determinate sentence. Had defendant been properly sentenced under this statute, he would have received— depending upon the predicate felony employed—a determinate sentence of either IV2 years as a felony drug offender (see Penal Law § 70.70 [2] [a] [iv]) or two years as a second felony drug offender (see Penal Law § 70.70 [3] [b] [iv]), followed by the appropriate period of postrelease supervision. Although defendant did admit to County Court that he was previously convicted of the drug felony described in the CPL 400.21 statement filed by the People, the court stated twice at sentencing that defendant was being sentenced to the minimum of two years of imprisonment because defendant had a prior violent felony conviction. Because of the lack of clarity in the sentencing record, the sentence is vacated and this matter is remitted to County Court for resentencing.
Cardona, P.J., Spain, Rose, Kane and Malone Jr., JJ., concur. Ordered that the judgment is modified, on the law, by vacating the sentence imposed; matter remitted to the County Court of Rensselaer County for resentencing; and, as so modified, affirmed.