In the event of dismissal of the criminal action or revocation proceedings before the defendant recovers competence, the person shall be subject to the applicable provisions of the Lanterman-Petris-Short Act (Part 1 (commencing with Section 5000) of Division 5 of the Welfare and Institutions Code) or to commitment or detention pursuant to a petition filed pursuant to Section 6502 of the Welfare and Institutions Code.
The defendant or prosecuting attorney may contest either kind of order of transfer by filing a petition with the court for a hearing, which shall be held if the court determines that sufficient grounds exist. At the hearing, the prosecuting attorney or the defendant may present evidence bearing on the order of transfer. The court shall use the same standards as used in conducting probation revocation hearings pursuant to Section 1203.2.
Prior to making an order for transfer under this section, the court shall notify the defendant, the attorney of record for the defendant, the prosecuting attorney, and the regional center director or designee.
Ca. Pen. Code § 1370.1