When the chief officer determines that a defendant in a state hospital or treatment resource who is charged with a crime is restored to competence to stand trial, the chief officer shall give notice of that fact to the clerk of the court by whose order the defendant was confined and deliver the defendant to the sheriff of the county from which the defendant was admitted.