A person accused of committing a crime shall be deemed to have been mentally ill at the time he or she committed the act in respect of which he or she is accused—
(a) if he or she was prevented, by reason of mental disorder, from knowing the nature or consequences of the act in respect of which he or she is accused, or if he or she did know it, he or she did not know that what he or she was doing was contrary to law;
(b) if he or she did the act in respect of which he or she is accused under the influence of a delusion of such a nature as to render him or her, in the opinion of the jury or of the Court, an unfit person for punishment of any kind in respect of such act.