Appeal by defendant, as limited by his brief, from a sentence of the Supreme Court, Kings County (Moskowitz, J.), imposed April 23, 1981, *635upon his conviction of criminal sale of a controlled substance in the second degree, upon his plea of guilty, the sentence being a period of imprisonment of five years to life. Sentence reversed, on the law, and the matter is remitted to the Supreme Court, Kings County, for resentencing in accordance with People v Farrar (52 NY2d 302). Insofar as it appears on the present record, Criminal Term refrained from exercising its discretion to impose a lesser sentence upon the defendant in the mistaken belief that it was legally bound to impose the sentence which had been agreed upon at the time of the negotiated plea. “[A] court must exercise its discretion at sentencing, notwithstanding that a sentence was negotiated at the time of the plea, and must be free to impose a lesser penalty if warranted” (People v Farrar, 52 NY2d 302, 308, supra). As a consequence of the court’s failure to exercise its discretion, the defendant is entitled to be resentenced in accordance with the principles set forth in People v Farrar (supra). However, the concomitant right of the People to withdraw their consent to the plea in the event that the sentence to be imposed is less than that originally negotiated by the parties must also be recognized (see People v Farrar, supra, pp 307-308). Damiani, J. P., Lazer, Gibbons and Gulotta, JJ-., concur.