Upon or after arraignment in a local criminal court upon an information, a prosecutor's information or a misdemeanor complaint, where the sole remaining count or counts charge a violation or violations of section 221.05, 221.10, 221.15, 221.35 or 221.40 of the penal law and before the entry of a plea of guilty thereto or commencement of a trial thereof, the court, upon motion of a defendant, may order that all proceedings be suspended and the action adjourned in contemplation of dismissal, or upon a finding that adjournment would not be necessary or appropriate and the setting forth in the record of the reasons for such findings, may dismiss in furtherance of justice the accusatory instrument; provided, however, that the court may not order such adjournment in contemplation of dismissal or dismiss the accusatory instrument if: (a) the defendant has previously been granted such adjournment in contemplation of dismissal, or (b) the defendant has previously been granted a dismissal under this section, or (c) the defendant has previously been convicted of any offense involving controlled substances, or (d) the defendant has previously been convicted of a crime and the district attorney does not consent or (e) the defendant has previously been adjudicated a youthful offender on the basis of any act or acts involving controlled substances and the district attorney does not consent.
2. Upon ordering the action adjourned in contemplation of dismissal, the court must set and specify such conditions for the adjournment as may be appropriate, and such conditions may include placing the defendant under the supervision of any public or private agency. At any time prior to dismissal the court may modify the conditions or extend or reduce the term of the adjournment, except that the total period of adjournment shall not exceed twelve months. Upon violation of any condition fixed by the court, the court may revoke its order and restore the case to the calendar and the prosecution thereupon must proceed. If the case is not so restored to the calendar during the period fixed by the court, the accusatory instrument is, at the expiration of such period, deemed to have been dismissed in the furtherance of justice.
3. Upon or after dismissal of such charges against a defendant not previously convicted of a crime, the court shall order that all official records and papers, relating to the defendant's arrest and prosecution, whether on file with the court, a police agency, or the New York state division of criminal justice services, be sealed and, except as otherwise provided in paragraph (d) of subdivision one of section 160.50 of this chapter, not made available to any person or public or private agency; except, such records shall be made available under order of a court for the purpose of determining whether, in subsequent proceedings, such person qualifies under this section for a dismissal or adjournment in contemplation of dismissal of the accusatory instrument.
4. Upon the granting of an order pursuant to subdivision three, the arrest and prosecution shall be deemed a nullity and the defendant shall be restored, in contemplation of law, to the status he occupied before his arrest and prosecution