(1)Whenever, in the course of a trial by a court-martial, it appears to the court that the person charged is by reason of unsoundness of mind incapable of making his defence, or that he committed the act alleged but was by reason of unsoundness of mind incapable of knowing the nature of the act or knowing that it was wrong or contrary to law, the court shall record a finding accordingly.