If the commissioner of correction determines from an examination that a person who is in the custody of the department of correction has a mental illness or serious emotional disturbance and because of the mental illness or serious emotional disturbance poses a substantial likelihood of serious harm, as defined in § 33-6-501, then the commissioner shall, no less than thirty (30) days before the person's scheduled release from a correctional facility, file a complaint with the clerk of the court that has jurisdiction under § 33-3-603 for the judicial commitment of the person to a hospital or treatment resource pursuant to title 33, chapter 6, part 5. The clerk shall serve to the person a copy of the complaint pursuant to § 33-3-605, and shall send a copy of the complaint to the district attorney general with jurisdiction in that district. A complaint filed under this section stays the release of the person pending completion of a hearing pursuant to title 33, chapter 3, part 6.
T.C.A. § 41-21-223