
    The People of the State of New York, Respondent, v Stephen A. Beach, Appellant.
   Kane, J.

Appeal from a judgment of the County Court of Albany County (Harris, J.), rendered October 4, 1988, convicting defendant upon his plea of guilty of the crime of criminal sale of a controlled substance in the third degree.

Defendant was indicted for two counts of the crime of criminal sale of a controlled substance in the third degree, a class B felony (see, Penal Law § 220.39 [1]). Following plea-bargaining negotiations, defendant pleaded guilty to one count of criminal sale of a controlled substance in the third degree. He was sentenced as indicated at the time of his plea and in accord with the plea agreement as a second felony offender to an indeterminate prison term of 4 to 8 years. However, defendant’s maximum sentence should have been at least nine years (see, Penal Law § 70.06 [3] [b]) with a minimum of one half of that (see, Penal Law § 70.06 [4] [b]). The sentence defendant did in fact receive was therefore illegal and, by operation of law, cannot stand (see, People v Shelton, 100 AD2d 775). Since the sentence promised at the time of defendant’s plea of guilty cannot be fulfilled, thus denying defendant the benefit of the plea bargain, he is entitled to vacatur of the sentence and should be given the opportunity to move to withdraw his plea of guilty (see, People v Shelton, supra; People v Rodriguez, 70 AD2d 509; People v Miller, 38 AD2d 745, 746).

Judgment modified, on the law, by vacating the sentence; 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., Kane, Weiss, Levine and Harvey, JJ., concur.  