Appeal from a judgment of the County Court of Cortland County (Campbell, J.), rendered June 9, 2005, convicting defendant upon his plea of guilty of the crime of attempted criminal possession of a controlled substance in the fourth degree.
*1178Defendant pleaded guilty to attempted criminal possession of a controlled substance in the fourth degree in satisfaction of a three-count indictment. Although the negotiated plea agreement provided that defendant would be sentenced to a 21/2-year prison term with two years of postrelease supervision, County Court advised defendant that if he was arrested prior to sentencing, he would be subject to an enhanced sentence. Defendant was thereafter arrested on two separate occasions prior to the date of his sentencing and, as a result, County Court sentenced him to 4V2 years in prison with two years of postrelease supervision. Defendant now appeals, asserting that County Court erred in failing to inquire about the arrests prior to sentencing him. We agree.
“ ‘When an issue is raised concerning the validity of [a] postplea charge or there is a denial of any involvement in the underlying crime, the court must conduct an inquiry at which the defendant has an opportunity to show that the arrest is without foundation’ ” (People v Curtis, 278 AD2d 664, 665 [2000], quoting People v Outley, 80 NY2d 702, 713 [1993], cert denied sub nom. Maietta v Artuz, 519 US 964 [1996]; see People v Valencia, 3 NY3d 714, 715 [2004]; People v Naranjo, 89 NY2d 1047, 1049 [1997]). While the nature and extent of the inquiry is discretionary, it “must be of sufficient depth ... so that the court can be satisfied—not of defendant’s guilt of the new criminal charge but of the existence of a legitimate basis for the arrest on that charge” (People v Outley, supra at 713). Here, when given the opportunity to comment on the arrests, defendant offered exculpatory explanations, claiming that one arrest was malicious and that he was not present at the time and location of the alleged offense underlying the second arrest. Despite these contentions by defendant, which served as a challenge to the validity of the arrests, County Court sentenced him to an enhanced prison term without further inquiry. Accordingly, inasmuch as County Court failed to ascertain whether there was a legitimate basis for the postplea arrests, we must remit this matter for a new sentencing hearing in accordance with this decision (see People v McClemore, 276 AD2d 32, 35-37 [2000]; cf. People v Douglas, 2 AD3d 1050, 1050-1051 [2003], lv denied 2 NY3d 761 [2004]).
The People’s remaining argument has been reviewed and found to be lacking in merit.
Cardona, P.J., Spain, Mugglin and Lahtinen, JJ., concur. Ordered that the judgment is modified, on the law, by vacating the sentence imposed; matter remitted to the County Court of Cortland County for resentencing; and, as so modified, affirmed.