When the accused appears to be of sound mind at the time of the inquiry or trial, and the Magistrate, based on the evidence presented before him, is satisfied that there is reason to believe the accused committed an act which, if he had been of sound mind, would have constituted an offence, and that at the time of committing the act, the accused, due to unsoundness of mind, was incapable of knowing the nature of the act or understanding that it was wrong or contrary to law, the Magistrate shall proceed with the case. If the Magistrate believes the case warrants trial by the Court of Session, he shall commit the accused for trial before that Court.