10 U.S.C. § 876b : US Code - Section 876B: Art. 76b. Lack of mental capacity or mental responsibility: commitment of accused for examination and treatment

      (a) Persons Incompetent To Stand Trial. - (1) In the case of a
    person determined under this chapter to be presently suffering from
    a mental disease or defect rendering the person mentally
    incompetent to the extent that the person is unable to understand
    the nature of the proceedings against that person or to conduct or
    cooperate intelligently in the defense of the case, the general
    court-martial convening authority for that person shall commit the
    person to the custody of the Attorney General.
      (2) The Attorney General shall take action in accordance with
    section 4241(d) of title 18.
      (3) If at the end of the period for hospitalization provided for
    in section 4241(d) of title 18, it is determined that the committed
    person's mental condition has not so improved as to permit the
    trial to proceed, action shall be taken in accordance with section
    4246 of such title.
      (4)(A) When the director of a facility in which a person is
    hospitalized pursuant to paragraph (2) determines that the person
    has recovered to such an extent that the person is able to
    understand the nature of the proceedings against the person and to
    conduct or cooperate intelligently in the defense of the case, the
    director shall promptly transmit a notification of that
    determination to the Attorney General and to the general court-
    martial convening authority for the person. The director shall
    send a copy of the notification to the person's counsel.
      (B) Upon receipt of a notification, the general court-martial
    convening authority shall promptly take custody of the person
    unless the person covered by the notification is no longer subject
    to this chapter. If the person is no longer subject to this
    chapter, the Attorney General shall take any action within the
    authority of the Attorney General that the Attorney General
    considers appropriate regarding the person.
      (C) The director of the facility may retain custody of the person
    for not more than 30 days after transmitting the notifications
    required by subparagraph (A).
      (5) In the application of section 4246 of title 18 to a case
    under this subsection, references to the court that ordered the
    commitment of a person, and to the clerk of such court, shall be
    deemed to refer to the general court-martial convening authority
    for that person. However, if the person is no longer subject to
    this chapter at a time relevant to the application of such section
    to the person, the United States district court for the district
    where the person is hospitalized or otherwise may be found shall be
    considered as the court that ordered the commitment of the person.
      (b) Persons Found Not Guilty by Reason of Lack of Mental
    Responsibility. - (1) If a person is found by a court-martial not
    guilty only by reason of lack of mental responsibility, the person
    shall be committed to a suitable facility until the person is
    eligible for release in accordance with this section.
      (2) The court-martial shall conduct a hearing on the mental
    condition in accordance with subsection (c) of section 4243 of
    title 18. Subsections (b) and (d) of that section shall apply with
    respect to the hearing.
      (3) A report of the results of the hearing shall be made to the
    general court-martial convening authority for the person.
      (4) If the court-martial fails to find by the standard specified
    in subsection (d) of section 4243 of title 18 that the person's
    release would not create a substantial risk of bodily injury to
    another person or serious damage of property of another due to a
    present mental disease or defect - 
        (A) the general court-martial convening authority may commit
      the person to the custody of the Attorney General; and
        (B) the Attorney General shall take action in accordance with
      subsection (e) of section 4243 of title 18.

      (5) Subsections (f), (g), and (h) of section 4243 of title 18
    shall apply in the case of a person hospitalized pursuant to
    paragraph (4)(B), except that the United States district court for
    the district where the person is hospitalized shall be considered
    as the court that ordered the person's commitment.
      (c) General Provisions. - (1) Except as otherwise provided in
    this subsection and subsection (d)(1), the provisions of section
    4247 of title 18 apply in the administration of this section.
      (2) In the application of section 4247(d) of title 18 to hearings
    conducted by a court-martial under this section or by (or by order
    of) a general court-martial convening authority under this section,
    the reference in that section to section 3006A of such title does
    not apply.
      (d) Applicability. - (1) The provisions of chapter 313 of title
    18 referred to in this section apply according to the provisions of
    this section notwithstanding section 4247(j) of title 18.
      (2) If the status of a person as described in section 802 of this
    title (article 2) terminates while the person is, pursuant to this
    section, in the custody of the Attorney General, hospitalized, or
    on conditional release under a prescribed regimen of medical,
    psychiatric, or psychological care or treatment, the provisions of
    this section establishing requirements and procedures regarding a
    person no longer subject to this chapter shall continue to apply to
    that person notwithstanding the change of status.