Appeal by the defendant from a judgment of the County Court, Suffolk County (Braslow, J.), rendered July 12, 2004, convicting him of criminal sale of a controlled substance in the third degree, upon his plea of guilty, and imposing sentence.
Ordered that the judgment is reversed, on the law, and the matter is remitted to the County Court, Suffolk County, to afford the defendant an opportunity to withdraw his plea of guilty.
The defendant pleaded guilty with the understanding that he would be sentenced to an indeterminate term of 472 to 9 years imprisonment. The transcript of the plea proceeding does not indicate that the defendant was told that if he failed to appear for sentencing or was rearrested on another charge, the County Court could impose an enhanced sentence. The defendant failed to appear for sentencing and was rearrested on another charge.
At sentencing, before the imposition of sentence, the defendant moved to withdraw his plea of guilty, contending that his counsel was ineffective. The County Court denied his motion. The defendant then asked the court for its reasons. After the defendant argued with the court about the denial of his motion, the court stated that despite the defendant’s new arrest “when you came out today I was originally going to give you four and a half to nine years,” but the court decided to impose an enhanced sentence “[b]ecause you got such a great attitude.” The defendant was warned that if he said anything more he would be held in contempt. Thus, the defendant never had an opportunity to object to the imposition of the enhanced sentence or move to withdraw his plea of guilty based upon the enhanced sentence.
Under the circumstances, the imposition of an enhanced *487sentence without affording the defendant an opportunity to withdraw his plea of guilty was error (see People v Calendar, 227 AD2d 639 [1996]; People v Rosa, 194 AD2d 755 [1993]). H. Miller, J.P., S. Miller, Goldstein, Mastro and Lifson, JJ., concur.