If, after the hearing, the court finds by a preponderance of the evidence that the defendant is presently suffering from a mental disease or developmental disability, or other conditions set forth in § 23A-10A-1, rendering the defendant mentally incompetent to the extent that the defendant is unable to understand the nature and consequences of the proceedings against the defendant or to assist properly in the defense, the court shall order the defendant to be placed in a restoration to competency program under the direction of an approved facility, commit the defendant to the custody of an approved facility having residential capability, or order the defendant to be placed on outpatient status for restoration to competency if the court makes a written finding that the defendant is not considered to be a danger to the health and safety of others and is otherwise eligible for bond. A defendant placed on outpatient status is subject to the provisions of chapter 23A-43. The defendant shall be treated for a reasonable period of time, not to exceed four months, as is necessary to determine whether there is a substantial probability that in the foreseeable future the defendant will attain the capacity to permit the trial to proceed. No commitment may be made to an approved facility that is not owned by the state without first obtaining the consent of the administrator of the privately owned facility.
SDCL 23A-10A-4