CrPC 333: Section 333 of the Criminal Procedure Code
When accused appears to have been of sound mind
When the accused appears to be of sound mind at the time of inquiry or trial, and the Magistrate is satisfied from the evidence given before him that there is reason to believe that the accused committed an act, which, if he had been of sound mind, would have been an offence, and that he was, at the time when the act was committed, by reason of unsoundness of mind, incapable of knowing the nature of the act or that it was wrong or contrary to law, the Magistrate shall proceed with the case, and, if the accused ought to be tried by the Court of Session, commit him for trial before the Court of Session.