law: 154. Discharge or removal of prisoners.
  Whenever any offender is undergoing imprisonment or detention in pursuance of this Act, it shall be lawful for the Central Government or the Chief of the Naval Staff, or where an offender is undergoing imprisonment or detention by order of his commanding officer, for such commanding officer or the Central Government or the Chief of the Naval Staff, to give an order in writing in the prescribed form directing that the offender be discharged; and it shall also be lawful for the Central Government and the Chief of the Naval Staff, by order in writing in the prescribed form, to direct that any such offender be delivered over to naval custody for the purpose of being brought before a court-martial, either as a witness or for trial or otherwise, and such offender shall accordingly, on the production of any such order, be discharged, or be delivered over to such custody.