Quick search by citation:

24 U.S. Code § 326 - Release of patient

(a) Request; determination of right to retain; retention after request

If a person who is a patient hospitalized under section 322 or 324 of this title, or his legal guardian, spouse, or adult next of kin, requests the release of such patient, the right of the Secretary, or the head of the hospital, to detain him for care and treatment shall be determined in accordance with such laws governing the detention, for care and treatment, of persons alleged to be mentally ill as may be in force and applicable generally in the State in which such hospital is located, but in no event shall the patient be detained more than forty-eight hours (excluding any period of time falling on a Sunday or legal holiday) after the receipt of such request unless within such time (1) judicial proceedings for such hospitalization are commenced or (2) a judicial extension of such time is obtained, for a period of not more than five days, for the commencement of such proceedings.

(b) Transfer to another hospital

The Secretary is authorized at any time, when he deems it to be in the interest of the person or of the institution affected, to transfer any person hospitalized under section 324 of this title from one hospital to another, and to that end any judicial commitment of any person so hospitalized may be to the Secretary.