<?xml version="1.0"?>
<law><site_title>Virginia Decoded</site_title><site_url>https://vacode.org</site_url><law_id>70993</law_id><section_number>37.2-844</section_number><catch_line>Habeas corpus as means</catch_line><edition url="https://vacode.org/2025/" slug="2025" current="TRUE" last_updated="">2025</edition><referred_to_by><reference>37.2-821</reference><reference>37.2-845</reference></referred_to_by><structure><unit label="title" level="1" order_by="1" identifier="37.2">Behavioral Health and Developmental Services</unit><unit label="subtitle" level="2" order_by="1" identifier="III">Admissions and Dispositions</unit><unit label="chapter" level="3" order_by="1" identifier="8">Emergency Custody and Voluntary and Involuntary Civil Admissions</unit><unit label="article" level="4" order_by="1" identifier="8">Testing Legality of Detention</unit></structure><text>
						<section id="A"><p><span class="prefix-number">A.</span> Any person held in <span class="dictionary">custody</span> because of his <span class="dictionary">mental illness</span> may by <span class="dictionary">petition</span> for a <span class="dictionary">writ</span> of <span class="dictionary">habeas corpus</span> have the question of the legality of his detention determined by a <span class="dictionary">court</span> of competent <span class="dictionary">jurisdiction</span>. Upon the <span class="dictionary">petition</span>, after notice to the authorities of the <span class="dictionary">facility</span> or other institution in which the person is confined, the <span class="dictionary">court</span> shall determine in a courtroom of the county or city or in some other convenient public place in that county or city, whether the person has a <span class="dictionary">mental illness</span> and whether he should be detained. <a id="paragraph-255999" class="section-permalink" href="https://vacode.org/37.2-844/#A"><i class="fa fa-link"/></a></p></section>
						<section id="B"><p><span class="prefix-number">B.</span> Any proceeding to challenge the continued secure inpatient treatment of a person held in <span class="dictionary">custody</span> as a sexually violent predator under Chapter 9 (&#xA7; <a class="law" title="Definitions" href="/37.2-900/">37.2-900</a> et seq.) of this title shall be conducted in accordance with &#xA7; <a class="law" title="Review of continuation of secure inpatient treatment hearing; procedure and reports; disposition" href="/37.2-910/">37.2-910</a>. <a id="paragraph-256000" class="section-permalink" href="https://vacode.org/37.2-844/#B"><i class="fa fa-link"/></a></p></section></text><history>Code 1950, &#xA7;&#xA7; 37-122, 37-123; 1950, p. 916; 1968, c. 477, &#xA7; 37.1-103; 1976, c. 671; 2003, cc. 989, 1018; 2005, c. 716.</history><metadata></metadata></law>
