During any proceeding to determine whether to release a person with mental illness or serious emotional disturbance, or intellectual disability seeking release by means of a writ of habeas corpus under this part or § 33-3-101, or otherwise, the court shall also, if the issue is raised in the responsive pleading, determine whether the person seeking release presently has mental illness or serious emotional disturbance, or intellectual disability and meets the standards for involuntary commitment under chapter 6, part 5 of this title.
T.C.A. § 33-3-802