(b)if such person is detained under the said sub-section (5), on a certificate from any of the authorities mentioned in clause (b) of section 122 that in the judgment of such officer or authority such person may be released without danger of his doing injury to himself or to any other person,