{"formats":[{"name":"JSON","format":"json","url":"\/downloads\/2026\/code-json\/37.2-844.json"},{"name":"Plain Text","format":"text","url":"\/downloads\/2026\/code-text\/37.2-844.txt"},{"name":"XML","format":"xml","url":"\/downloads\/2026\/code-xml\/37.2-844.xml"},{"name":"HTML","format":"html","url":"\/downloads\/2026\/code-html\/37.2-844.html"}],"law_id":361092,"edition_id":2,"section_id":361092,"structure_id":51642,"section_number":"37.2-844","catch_line":"Habeas corpus as means","history":"Code 1950, \u00a7\u00a7 37-122, 37-123; 1950, p. 916; 1968, c. 477, \u00a7 37.1-103; 1976, c. 671; 2003, cc. 989, 1018; 2005, c. 716.","full_text":"A\n\nAny person held in custody because of his mental illness may by petition for a writ of habeas corpus have the question of the legality of his detention determined by a court of competent jurisdiction. Upon the petition, after notice to the authorities of the facility or other institution in which the person is confined, the court 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 mental illness and whether he should be detained.\n\nB\n\nAny proceeding to challenge the continued secure inpatient treatment of a person held in custody as a sexually violent predator under Chapter 9 (&#xA7; 37.2-900 et seq.) of this title shall be conducted in accordance with &#xA7; 37.2-910.\n\n","order_by":null,"text":{"0":{"id":1343755,"text":"Any person held in custody because of his mental illness may by petition for a writ of habeas corpus have the question of the legality of his detention determined by a court of competent jurisdiction. Upon the petition, after notice to the authorities of the facility or other institution in which the person is confined, the court 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 mental illness and whether he should be detained.","type":"section","prefixes":["A"],"prefix":"A","entire_prefix":"A","prefix_anchor":"A","level":1,"next_prefix":"B"},"1":{"id":1343756,"text":"Any proceeding to challenge the continued secure inpatient treatment of a person held in custody as a sexually violent predator under Chapter 9 (&#xA7; 37.2-900 et seq.) of this title shall be conducted in accordance with &#xA7; 37.2-910.","type":"section","prefixes":["B"],"prefix":"B","entire_prefix":"B","prefix_anchor":"B","level":1,"prior_prefix":"A"}},"ancestry":[{"id":51642,"edition_id":2,"name":"Testing Legality of Detention","identifier":"8","label":"article","depth":4,"order_by":8,"parent_id":51634,"metadata":{"child_laws":4,"child_structures":0},"date_created":"2026-08-02 02:45:26","date_modified":"2026-08-02 12:32:54","permalink":{"id":1437487,"object_type":"structure","relational_id":51642,"identifier":"8","token":"37.2\/III\/8\/8","url":"\/37.2\/III\/8\/8\/","edition_id":2,"permalink":0,"preferred":1}},{"id":51634,"edition_id":2,"name":"Emergency Custody and Voluntary and Involuntary Civil Admissions","identifier":"8","label":"chapter","depth":3,"order_by":1,"parent_id":51633,"metadata":{"child_laws":57,"child_structures":8},"date_created":"2026-08-02 02:45:19","date_modified":"2026-08-02 12:32:52","permalink":{"id":1437259,"object_type":"structure","relational_id":51634,"identifier":"8","token":"37.2\/III\/8","url":"\/37.2\/III\/8\/","edition_id":2,"permalink":0,"preferred":1}},{"id":51633,"edition_id":2,"name":"Admissions and Dispositions","identifier":"III","label":"subtitle","depth":2,"order_by":3,"parent_id":51608,"metadata":{"child_laws":82,"child_structures":10},"date_created":"2026-08-02 02:45:19","date_modified":"2026-08-02 12:32:52","permalink":{"id":1437257,"object_type":"structure","relational_id":51633,"identifier":"III","token":"37.2\/III","url":"\/37.2\/III\/","edition_id":2,"permalink":0,"preferred":1}},{"id":51608,"edition_id":2,"name":"Behavioral Health and Developmental Services","identifier":"37.2","label":"title","depth":1,"order_by":85,"parent_id":null,"metadata":{"child_laws":229,"child_structures":35},"date_created":"2026-08-02 02:44:56","date_modified":"2026-08-02 12:32:46","permalink":{"id":1436675,"object_type":"structure","relational_id":51608,"identifier":"37.2","token":"37.2","url":"\/37.2\/","edition_id":2,"permalink":0,"preferred":1}}],"structure_contents":[{"id":361092,"structure_id":51642,"section_number":"37.2-844","catch_line":"Habeas corpus as means","url":"\/37.2-844\/","token":"37.2\/III\/8\/8\/37.2-844","metadata":false},{"id":361093,"structure_id":51642,"section_number":"37.2-845","catch_line":"Procedure when person confined in facility or other institution","url":"\/37.2-845\/","token":"37.2\/III\/8\/8\/37.2-845","metadata":false},{"id":361094,"structure_id":51642,"section_number":"37.2-846","catch_line":"Procedure when person not confined in facility or other institution","url":"\/37.2-846\/","token":"37.2\/III\/8\/8\/37.2-846","metadata":false},{"id":361095,"structure_id":51642,"section_number":"37.2-847","catch_line":"Duty of attorney for Commonwealth","url":"\/37.2-847\/","token":"37.2\/III\/8\/8\/37.2-847","metadata":false}],"next_section":{"id":361093,"structure_id":51642,"section_number":"37.2-845","catch_line":"Procedure when person confined in facility or other institution","url":"\/37.2-845\/","token":"37.2\/III\/8\/8\/37.2-845","metadata":false},"metadata":false,"official_url":"https:\/\/law.lis.virginia.gov\/vacode\/37.2-844\/","history_text":"<p>The record of this law\u2019s original creation isn\u2019t available online. It has been modified 4 times. Those modifications are cataloged by \u201cThe Acts of Assembly,\u201d a state publication, by year and chapter. Those modifications that can be read on the General Assembly\u2019s website will be linked accordingly. Those modifications are as follows: in 1968, chapter 477; in 1976, chapter 671; in 2003, chapters <a href=\"https:\/\/legacylis.virginia.gov\/cgi-bin\/legp604.exe?031+ful+CHAP0989\">989<\/a> and <a href=\"https:\/\/legacylis.virginia.gov\/cgi-bin\/legp604.exe?031+ful+CHAP1018\">1018<\/a>; in 2005, chapter <a href=\"https:\/\/legacylis.virginia.gov\/cgi-bin\/legp604.exe?051+ful+CHAP0716\">716<\/a>.<\/p>","references":[{"id":361069,"section_number":"37.2-821","catch_line":"Appeal of involuntary admission or certification order","order_by":null,"url":"\/37.2-821\/"},{"id":361093,"section_number":"37.2-845","catch_line":"Procedure when person confined in facility or other institution","order_by":null,"url":"\/37.2-845\/"}],"refers_to":[{"id":361097,"section_number":"37.2-900","catch_line":"Definitions","order_by":null,"url":"\/37.2-900\/"},{"id":361109,"section_number":"37.2-910","catch_line":"Review of continuation of secure inpatient treatment hearing; procedure and reports; disposition","order_by":null,"url":"\/37.2-910\/"}],"permalink":{"id":1437489,"object_type":"law","relational_id":361092,"identifier":"37.2-844","token":"37.2\/III\/8\/8\/37.2-844","url":"\/37.2-844\/","edition_id":2,"permalink":0,"preferred":1},"url":"\/37.2-844\/","token":"37.2\/III\/8\/8\/37.2-844","dublin_core":{"Title":"Habeas corpus as means","Type":"Text","Format":"text\/html","Identifier":"\u00a7 37.2-844","Relation":"Code of Virginia"},"html":"\n\t\t\t\t\t\t<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-1343755\" class=\"section-permalink\" href=\"https:\/\/vacode.org\/37.2-844\/#A\"><i class=\"fa fa-link\"><\/i><\/a><\/p><\/section>\n\t\t\t\t\t\t<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-1343756\" class=\"section-permalink\" href=\"https:\/\/vacode.org\/37.2-844\/#B\"><i class=\"fa fa-link\"><\/i><\/a><\/p><\/section>","plain_text":"                                 CODE OF VIRGINIA\n\nHABEAS CORPUS AS MEANS (\u00a7 37.2-844)\n\nA. Any person held in custody because of his mental illness may by petition for\na writ of habeas corpus have the question of the legality of his detention\ndetermined by a court of competent jurisdiction. Upon the petition, after notice\nto the authorities of the facility or other institution in which the person is\nconfined, the court shall determine in a courtroom of the county or city or in\nsome other convenient public place in that county or city, whether the person\nhas a mental illness and whether he should be detained.\n\nB. Any proceeding to challenge the continued secure inpatient treatment of a\nperson held in custody as a sexually violent predator under Chapter 9 (&#xA7;\n37.2-900 et seq.) of this title shall be conducted in accordance with &#xA7;\n37.2-910.\n\nHISTORY: Code 1950, \u00a7\u00a7 37-122, 37-123; 1950, p. 916; 1968, c. 477, \u00a7\n37.1-103; 1976, c. 671; 2003, cc. 989, 1018; 2005, c. 716.","edition":{"id":2,"name":"2026","slug":"2026","date_created":"2026-07-16 18:40:23","date_modified":"2026-08-02 15:14:36","current":1,"order_by":2,"last_import":"2026-08-02 12:37:30"}}