(1) When any person is detained under the provisions of section 466 or section 471 of the Code of Criminal Procedure, 1898 or under the provisions of section 130 of the Pakistan Army Act, 1952, the Inspector-General of Prisons, if such person is detained in a jail or the visitors of the asylum or any two of them, if he is detained in an asylum,...