A second class of cases arises when an accused person appears to be of sound mind at the time of ... trial, but there is reason to believe that he was of unsound mind at the time of committing the offence with which he is charged. In such cases the Magistrate must proceed to determine the facts with reference to section 84 of the Pakistan Penal ...