(1) a court with criminal jurisdiction holds a hearing to commit an adult with mental illness under § 33-7-301, AND
(2) the court finds on proof by clear and convincing evidence that the person is:
(A) charged with a felony,
(B) incompetent to stand trial,
(C) not committable under § 33-6-502, AND
(D) at risk of becoming committable, AND
(3) the department certifies to the court that there are funds available within the limits of the department's line item appropriation for services under this section for service to the person,
(4) the court may order the person to participate in community-based services under a plan approved and developed by the department to attain and maintain competence to stand trial and reduce the risk of becoming committable.