(1) It shall be lawful for the Governor, in any case in which a protected prisoner of war or a protected internee is convicted of an offence and sentenced to a term of imprisonment, to direct that there shall be deducted from that term a period not exceeding the period, if any, during which that person was in custody in connection with that offence, either on remand or after committal for trial (including the period of the trial), before the sentence began, or is deemed to have begun, to run.