(a) If a defendant charged with any offense other than a crime of violence, as defined in § 23-1331(4), does not attain competence within 180 days of an order for treatment pursuant to § 24-531.05, the charge shall be dismissed without prejudice upon:
(1) The completion of civil commitment proceedings, if a petition for commitment was filed; or
(2) A determination by the court that the time within which the government must file a petition for civil commitment has expired and a petition for civil commitment has not been filed.
(b) If a defendant charged with a crime of violence, as defined in § 23-1331(4), except murder, first degree sexual abuse, or first degree child sexual abuse, has not attained competence within 5 years of the initial order for treatment pursuant to § 24-531.04, the charge shall be dismissed without prejudice.
(c) Any charge dismissed pursuant to subsection (a) or (b) of this section may be refiled if, at any time within the statute of limitations, the defendant attains competence; provided, that a defendant may not be arrested or detained on such a charge unless a court has found that the defendant is competent.
(d) Nothing in this section shall preclude the prosecutor or the defendant from moving to dismiss a case at an earlier time on any appropriate grounds.