The Code of Criminal Procedure, 1973 (CrPc)
329. Procedure in case of person of unsound mind tried before court.
(1) If at the trial of any person before a Magistrate or Court of Session, it appears to the Magistrate or court that such person is of unsound mind and consequently incapable of making his defence, the Magistrate or court shall, in the first instance, try the fact of such unsoundness and incapacity, and if the Magistrate or court, after considering such medical and other evidence as may be produced before him or it, is satisfied of the fact, he or it shall record a finding to that effect and shall postpone further proceedings in the case.
(2) The trial of the fact of the unsoundness of mind and incapacity of the accused shall be deemed to be part of his trial before the Magistrate or court.