(5)of section 145, on a certificate of the Inspector General of Prisons, and if such person is detained in a lunatic asylum under the said sub- section on a certificate of any two or more of the visitors of such asylum that he is capable of making his defence, take steps to have such person tried by the same or another court-martial for the offence with which he was originally charged or, if the offence is a civil offence, by a criminal court.