Any person in the custody of the Commissioner of Correction who is brought to a hospital pursuant to the provisions of sections 17a-499, 17a-509, 17a-512 to 17a-516, inclusive, 17a-520, 17a-521, or 54-56d shall be hospitalized in the Whiting Forensic Hospital. If the Whiting Forensic Hospital is unable to accommodate such transfer, then such person shall remain in the custody of the commissioner at a correctional institution, there confined under appropriate care and supervision. Under no circumstances shall an inmate with psychiatric disabilities requiring maximum security conditions be placed in a state hospital for persons with psychiatric disabilities which does not have the facilities and trained personnel to provide appropriate care and supervision for such individuals.