Memorandum: Defendant appeals from a judgment convicting him upon his plea of guilty of criminal possession of a controlled substance in the fifth degree (Penal Law § 220.06 [1]). We agree with defendant that he should have been permitted to withdraw his plea. Defendant was arraigned on an indictment before County Court (Fahey, J.). The matter was then transferred to the Syracuse Community Treatment Court (drug court) for an alcohol and substance abuse evaluation and consideration of judicial diversion pursuant to CPL 216.05 (1). The parties and the drug court, i.e., Acting County Court Judge Merrill, agreed to defendant’s participation in alcohol and substance abuse treatment (see CPL 216.05 [4]), and defendant entered his plea. Although at the time of the plea the drug court indicated that *1243there would be a “[d]rug [c]ourt contract,” at no time did defendant “agree on the record or in writing to abide by the release conditions” of drug court (CPL 216.05 [5]). Rather, when defendant returned to drug court a few weeks later to sign the contract, he decided to forgo judicial diversion. When the drug court indicated that it would proceed to sentencing, defendant moved to withdraw his plea, and the motion was denied.
We agree with defendant that he never entered judicial diversion and thus that the drug court should have granted his motion and transferred the matter back to County Court for further proceedings. We disagree with the drug court that defendant entered judicial diversion and then voluntarily terminated his participation pursuant to CPL 216.05 (9) (e). There was never an order issued pursuant to CPL 216.05 (4) granting judicial diversion and, although a plea was entered pursuant to that section, there was no agreement by defendant on the record or in writing to the terms and conditions of drug court as set forth in CPL 216.05 (5). Present — Centra, J.E, Fahey, Peradotto, Garni and Lindley, JJ.