(1) If at any time prior to or during trial it appears that the defendant has become mentally incompetent to stand trial, such disability may be called to the attention of the district or county court by the county attorney or city attorney, by the defendant, or by any person for the defendant. The judge of the district or county court of the county where the defendant is to be tried shall have the authority to determine whether or not the defendant is competent to stand trial. The judge may also cause such medical, psychiatric, or psychological examination of the defendant to be made as he or she deems warranted and hold such hearing as he or she deems necessary. The cost of the examination, when ordered by the court, shall be the expense of the county in which the crime is charged. The judge may allow any physician, psychiatrist, or psychologist a reasonable fee for his or her services, which amount, when determined by the judge, shall be certified to the county board which shall cause payment to be made. Should the judge determine after a hearing that the defendant is mentally incompetent to stand trial and that there is a substantial probability that the defendant will become competent within the reasonably foreseeable future, the judge shall order the defendant to be committed to the Department of Health and Human Services to provide appropriate treatment to restore competency. This may include commitment to a state hospital for the mentally ill, another appropriate state-owned or state-operated facility, or a contract facility or provider pursuant to an alternative treatment plan proposed by the department and approved by the court under subsection (2) of this section until such time as the disability may be removed.
(2)(a) If the department determines that treatment by a contract facility or provider is appropriate, the department shall file a report outlining its determination and such alternative treatment plan with the court. Within twenty-one days after the filing of such report, the court shall hold a hearing to determine whether such treatment is appropriate. The court may approve or deny such alternative treatment plan.
(b) A defendant shall not be eligible for treatment by a contract facility or provider under this subsection if the judge determines that the public's safety would be at risk.
(3) Within sixty days after entry of the order committing the defendant to the department, and every sixty days thereafter until either the disability is removed or other disposition of the defendant has been made, the court shall hold a hearing to determine (a) whether the defendant is competent to stand trial or (b) whether or not there is a substantial probability that the defendant will become competent within the reasonably foreseeable future.
(4) If it is determined that there is not a substantial probability that the defendant will become competent within the reasonably foreseeable future, then the state shall either (a) commence the applicable civil commitment proceeding that would be required to commit any other person for an indefinite period of time or (b) release the defendant. If during the period of time between the sixty-day review hearings set forth in subsection (3) of this section it is the opinion of the department that the defendant is competent to stand trial, the department shall file a report outlining its opinion with the court and within seven days after such report being filed the court shall hold a hearing to determine whether or not the defendant is competent to stand trial. The state shall pay the cost of maintenance and care of the defendant during the period of time ordered by the court for treatment to remove the disability.
(5) The defendant, by and through counsel, may move to be discharged from the offenses charged in the complaint or information for the reason that there is not a substantial probability that the defendant will become competent within the reasonably foreseeable future.
(6) In determining whether there is a substantial probability that a defendant will become competent in the reasonably foreseeable future, the court shall take into consideration the likely length of any sentence that would be imposed upon the defendant. If the court discharges the defendant, the court shall state whether such discharge is with or without prejudice.
(7)(a) If a judge orders a defendant to be committed to the Department of Health and Human Services to receive treatment to restore competency and such defendant remains lodged in the county jail, the department shall reimburse the county for lodging the defendant.
(b) Costs of lodging the defendant shall include the daily rate of lodging the defendant, food, medical services, transportation, and any other necessary costs incurred by the county to lodge the defendant.
(c) The daily rate of lodging the defendant shall be one hundred dollars per day for each day or portion thereof after the first thirty days that the defendant is lodged in the county jail after a determination by a judge that the defendant is required to be restored to competency. On July 1, 2023, and each July 1 thereafter, the department shall adjust the amount to be reimbursed to the county jails by an amount equal to the percentage increase, if any, in the Consumer Price Index for All Urban Consumers, as published by the United States Department of Labor, Bureau of Labor Statistics, for the twelve months ending on June 30 of such year.
(d) For purposes of this section, medical services has the same meaning as provided in subsection (2) of section 47-701.