Appeal from a judgment of the County Court of Schenectady County (Córtese, J.), rendered November 6, 2006, convicting defendant upon his plea of guilty of the crime of attempted criminal sale of a controlled substance in the third degree.
In satisfaction of four felony drug charges, defendant pleaded guilty to attempted criminal sale of a controlled substance in the third degree, and he executed a written waiver of his right to appeal in open court and orally waived his appeal rights after County Court explained them on the record. Under the terms of the plea agreement, he was to be sentenced as a second felony offender to a maximum of six years in prison to be followed by anywhere from 3 to 5 years of postrelease supervision. Prior to sentencing, it was agreed that sentencing would be held in abeyance pending defendant’s participation in a substance abuse treatment program, the successful completion of which would entitle him to withdraw his plea, plead guilty to a misdemeanor *1111and be sentenced to time served. Defendant failed to successfully complete the program and was sentenced in accordance with the plea agreement. He now appeals.
Defense counsel seeks to be relieved of his assignment of representing defendant on the ground that there are no nonfrivolous issues to be raised on appeal. Based upon our review of the record, defense counsel’s brief and defendant’s pro se submission, we agree. Defendant entered a knowing, voluntary and intelligent guilty plea and waiver of the right to appeal. Inasmuch as he did not satisfactorily complete the substance abuse treatment program, he was not entitled to a reduced sentence. Accordingly, the judgment is affirmed and counsel’s application for leave to withdraw is granted (see People v Cruwys, 113 AD2d 979 [1985], lv denied 67 NY2d 650 [1986]; see generally People v Stokes, 95 NY2d 633 [2001]).
Cardona, P.J., Mercure, Spain, Lahtinen and Kane, JJ., concur. Ordered that the judgment is affirmed, and application to be relieved of assignment granted.