(a) Within five days of the receipt of the qualified forensic evaluator's report and opinion on the issue of competency to stand trial, the court of record shall make a preliminary finding on the issue of whether the defendant is competent to stand trial and if not competent whether there is a substantial likelihood that the defendant will attain competency within the next three months. If the court of record orders, or if the state or defendant or defendant's counsel within twenty days of receipt of the preliminary findings requests, a hearing, then a hearing shall be held by the court of record within fifteen days of the date of the preliminary finding, absent good cause being shown for a continuance. If a hearing order or request is not filed within twenty days, the preliminary findings of the court become the final order.
(b) At a hearing to determine a defendant's competency to stand trial the defendant has the right to be present and he or she has the right to be represented by counsel and introduce evidence and cross-examine witnesses. The defendant shall be afforded timely and adequate notice of the issues at the hearing and shall have access to all forensic evaluator's opinions. All rights generally afforded a defendant in criminal proceedings shall be afforded to a defendant in the competency proceedings, except trial by jury.
(c) The court of record pursuant to a preliminary finding or hearing on the issue of a defendant's competency to stand trial and with due consideration of any forensic evaluation conducted pursuant to sections two and three of this article shall make a finding of fact upon a preponderance of the evidence as to the defendant's competency to stand trial based on whether or not the defendant has sufficient present ability to consult with his or her lawyer with a reasonable degree of rational understanding and whether he or she has a rational as well as a factual understanding of the proceedings against him or her.
(d) If at any point in the proceedings the defendant is found competent to stand trial, the court of record shall forthwith proceed with the criminal proceedings.
(e) If at any point in the proceedings the defendant is found not competent to stand trial, the court of record shall at the same hearing, upon the evidence, make further findings as to whether or not there is a substantial likelihood that the defendant will attain competency within the next ensuing three months.
(f) If at any point in the proceedings the defendant is found not competent to stand trial and is found substantially likely to attain competency, the court of record shall in the same order, upon the evidence, make further findings as to whether the defendant requires, in order to attain competency, inpatient management in a mental health facility. If inpatient management is required, the court shall order the defendant be committed to an inpatient mental health facility designated by the department to attain competency to stand trial and for a competency evaluation. The term of this commitment may not exceed three months from the time of entry into the facility. However, upon request by the chief medical officer of the mental health facility and based on the requirement for additional management to attain competency to stand trial, the court of record may, prior to the termination of the three-month period, extend the period up to nine months from entry into the facility. A forensic evaluation of competency to stand trial shall be conducted by a qualified forensic evaluator and a report rendered to the court, in like manner as subsections (a) and (c), section two of this article, every three months until the court determines the defendant is not competent to stand trial and is not substantially likely to attain competency.
(g) If at any point in the proceedings the defendant is found not competent to stand trial and is found not substantially likely to attain competency and if the defendant has been indicted or charged with a misdemeanor or felony which does not involve an act of violence against a person, the criminal charges shall be dismissed. The dismissal order may, however, be stayed for twenty days to allow civil commitment proceedings to be instituted by the prosecutor pursuant to article five of this chapter. The defendant shall be immediately released from any inpatient facility unless civilly committed.
(h) If at any point in the proceedings the defendant is found not competent to stand trial and is found not substantially likely to attain competency, and if the defendant has been indicted or charged with a misdemeanor or felony in which the misdemeanor or felony does involve an act of violence against a person, then the court shall determine on the record the offense or offenses of which the person otherwise would have been convicted, and the maximum sentence he or she could have received. A defendant shall remain under the court's jurisdiction until the expiration of the maximum sentence unless the defendant attains competency to stand trial and the criminal charges reach resolution or the court dismisses the indictment or charge. The court shall order the defendant be committed to a mental health facility designated by the department that is the least restrictive environment to manage the defendant and that will allow for the protection of the public. Notice of the maximum sentence period with an end date shall be provided to the mental health facility. The court shall order a qualified forensic evaluator to conduct a dangerousness evaluation to include dangerousness risk factors to be completed within thirty days of admission to the mental health facility and a report rendered to the court within ten business days of the completion of the evaluation. The medical director of the mental health facility shall provide the court a written clinical summary report of the defendant's condition at least annually during the time of the court's jurisdiction. The court's jurisdiction shall continue an additional ten days beyond any expiration to allow civil commitment proceedings to be instituted by the prosecutor pursuant to article five of this chapter. The defendant shall then be immediately released from the facility unless civilly committed.
(i) If the defendant has been ordered to a mental health facility pursuant to subsection (h) of this section and the court receives notice from the medical director or other responsible official of the mental health facility that the defendant no longer constitutes a significant danger to self or others, the court shall conduct a hearing within thirty days to consider evidence, with due consideration of the qualified forensic evaluator's dangerousness report or clinical summary report to determine if the defendant shall be released to a less restrictive environment. The court may order the release of the defendant only when the court finds that the defendant is no longer a significant danger to self or others. When a defendant's dangerousness risk factors associated with mental illness are reduced or eliminated as a result of any treatment, the court, in its discretion, may make the continuance of appropriate treatment, including medications, a condition of the defendant's release from inpatient hospitalization. The court shall maintain jurisdiction of the defendant in accordance with said subsection. Upon notice that a defendant ordered to a mental health facility pursuant to said subsection who is released on the condition that he or she continues treatment does not continue his or her treatment, the prosecuting attorney shall, by motion, cause the court to reconsider the defendant's release. Upon a showing that defendant is in violation of the conditions of his or her release, the court shall reorder the defendant to a mental health facility under the authority of the department which is the least restrictive setting that will allow for the protection of the public.
(j) The prosecuting attorney may, by motion, and in due consideration of any chief medical officer's or forensic evaluator's reports, cause the competency to stand trial of a defendant subject to the court's jurisdiction pursuant to subsection (h) of this section or released pursuant to subsection (i) of this section to be determined by the court of record while the defendant remains under the jurisdiction of the court, and in which case the court may order a forensic evaluation of competency to stand trial be conducted by a qualified forensic evaluator and a report rendered to the court in like manner as subsections (a) and (c), section two of this article.
(k) Any defendant found not competent to stand trial may at any time petition the court of record for a hearing on his or her competency.
(l) Notice of court findings of a defendant's competency to stand trial, of commitment for inpatient management to attain competency, of dismissal of charges, of order for inpatient management to protect the public, of release or conditional release, or any hearings to be conducted pursuant to this section shall be sent to the prosecuting attorney, the defendant and his or her counsel, and the mental health facility. Notice of court release hearing or order for release or conditional release pursuant to subsection (i) of this section shall be made available to the victim or next of kin of the victim of the offense for which the defendant was charged. The burden is on the victim or next of kin of the victim to keep the court apprised of that person's current mailing address.
(m) A mental health facility not operated by the state is not obligated to admit or treat a defendant under this section.