CA Penal Code § 1368.1 (2021)
2021 California Code|Penal Code - PEN|PART 2 - OF CRIMINAL PROCEDURE|TITLE 10 - MISCELLANEOUS PROCEEDINGS|CHAPTER 6 - Inquiry into the Competence of the Defendant Before Trial or After Conviction|Section 1368.1.

1368.1.  (a) (1) If the action is on a complaint charging a felony, proceedings to determine mental competence shall be held prior to the filing of an information unless the counsel for the defendant requests a preliminary examination under Section 859b. At the preliminary examination, counsel for the defendant may either demur, move to dismiss the complaint on the ground that there is not reasonable cause to believe that a felony has been committed and that the defendant is guilty thereof, or make a motion under Section 1538.5. A proceeding to determine mental competence or a request for a preliminary examination pursuant to this paragraph does not preclude a request for a determination of probable cause pursuant to paragraph (2).(2) If the action is on a complaint charging a felony involving death, great bodily harm, or a serious threat to the physical well-being of another person, the prosecuting attorney may, at any time before or after a defendant is determined incompetent to stand trial, request a determination of probable cause to believe the defendant committed the offense or offenses alleged in the complaint, solely for the purpose of establishing that the defendant is gravely disabled pursuant to subparagraph (B) of paragraph (1) of subdivision (h) of Section 5008 of the Welfare and Institutions Code, pursuant to procedures approved by the court. In making this determination, the court shall consider using procedures consistent with the manner in which a preliminary examination is conducted. A finding of probable cause shall only be made upon the presentation of evidence sufficient to satisfy the standard set forth in subdivision (a) of Section 872. The defendant shall be entitled to a preliminary hearing after the restoration of his or her competence. A request for a determination of probable cause pursuant to this paragraph does not preclude a proceeding to determine mental competence or a request for a preliminary examination pursuant to paragraph (1).(b) If the action is on a complaint charging a misdemeanor, counsel for the defendant may either demur, move to dismiss the complaint on the ground that there is not reasonable cause to believe that a public offense has been committed and that the defendant is guilty thereof, or make a motion under Section 1538.5.(c) If the proceeding involves an alleged violation of probation, mandatory supervision, postrelease community supervision, or parole, counsel for the defendant may move to reinstate supervision on the ground that there is not probable cause to believe that the defendant violated the terms of his or her supervision.(d) In ruling upon any demurrer or motion described in subdivision (a), (b), or (c), the court may hear any matter which is capable of fair determination without the personal participation of the defendant.(e) A demurrer or motion described in subdivision (a), (b), or (c) shall be made in the court having jurisdiction over the complaint. The defendant shall not be certified until the demurrer or motion has been decided.(Amended by Stats. 2017, Ch. 246, Sec. 1. (SB 684) Effective January 1, 2018.)