`(36)(A) Subject to subparagraph (B), the term `has been adjudicated mentally incompetent or has been committed to a psychiatric hospital', with respect to a person--
`(i) means the person is the subject of an order or finding by a judicial officer, court, board, commission, or other adjudicative body--
`(I) that was issued after a hearing--
`(aa) of which the person received actual notice; and
`(bb) at which the person had an opportunity to participate with counsel; and
`(II) that found that the person, as a result of marked subnormal intelligence, mental impairment, or mental illness--
`(aa) was an imminent danger to himself or to others;
`(bb) was guilty but mentally ill in a criminal case;
`(cc) was not guilty in a criminal case by reason of insanity or mental disease or defect;
`(dd) was incompetent to stand trial in a criminal case;
`(ee) was not guilty only by reason of lack of mental responsibility under section 850a of title 10 (article 50a of the Uniform Code of Military Justice);
`(ff) required involuntary inpatient treatment by a psychiatric hospital;
`(gg) required involuntary outpatient treatment by a psychiatric hospital based on a finding that the person is an imminent danger to himself or to others; or
`(hh) required involuntary commitment to a psychiatric hospital for any reason, including drug use; and
`(ii) does not include--
`(I) a person who is in a psychiatric hospital for observation; or
`(II) a voluntary admission to a psychiatric hospital.
`(B) In this paragraph, the term `order or finding' does not include--
`(i) an order or finding that--
`(I) has expired or has been set aside or expunged; or
`(II) requires treatment, supervision, or monitoring of a person, from which treatment, supervision, or monitoring the person has been fully released or discharged;
`(ii) an order or finding that is no longer applicable because a judicial officer, court, board, commission, or other adjudicative body has found that the person who is the subject of the order or finding--
`(I) does not present a danger to himself or to others;
`(II) has been restored to sanity or cured of mental disease or defect;
`(III) has been restored to competency; or
`(IV) no longer requires involuntary inpatient or outpatient treatment by, or involuntary commitment to, a psychiatric hospital; or
`(iii) an order or finding with respect to which the person who is subject to the order or finding has been found to be rehabilitated or has been granted relief from disabilities through any procedure available under the law of the jurisdiction in which the order or finding was issued.