{"formats":[{"name":"JSON","format":"json","url":"\/downloads\/2026\/code-json\/37.2-847.json"},{"name":"Plain Text","format":"text","url":"\/downloads\/2026\/code-text\/37.2-847.txt"},{"name":"XML","format":"xml","url":"\/downloads\/2026\/code-xml\/37.2-847.xml"},{"name":"HTML","format":"html","url":"\/downloads\/2026\/code-html\/37.2-847.html"}],"law_id":361095,"edition_id":2,"section_id":361095,"structure_id":51642,"section_number":"37.2-847","catch_line":"Duty of attorney for Commonwealth","history":"Code 1950, \u00a7 37-125; 1950, p. 916; 1968, c. 477, \u00a7 37.1-104.2; 1972, c. 639; 2005, c. 716.","full_text":"In any case to test the legality of the detention of a person pursuant to this article, whether by habeas corpus or otherwise, the attorney for the Commonwealth of the county or city in which the hearing is held shall, on request of the director of the facility or other institution having or claiming custody of the person, represent the Commonwealth in opposition to any such petition, appeal, or procedure for the discharge of the person from custody.\n\n","order_by":null,"text":{"0":{"id":1343761,"text":"In any case to test the legality of the detention of a person pursuant to this article, whether by habeas corpus or otherwise, the attorney for the Commonwealth of the county or city in which the hearing is held shall, on request of the director of the facility or other institution having or claiming custody of the person, represent the Commonwealth in opposition to any such petition, appeal, or procedure for the discharge of the person from custody.","type":"section","prefixes":[""],"prefix":"","entire_prefix":"","prefix_anchor":"","level":1}},"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}],"previous_section":{"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},"metadata":false,"official_url":"https:\/\/law.lis.virginia.gov\/vacode\/37.2-847\/","history_text":"<p>The record of this law\u2019s original creation isn\u2019t available online. It has been modified 3 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 1972, chapter 639; in 2005, chapter <a href=\"https:\/\/legacylis.virginia.gov\/cgi-bin\/legp604.exe?051+ful+CHAP0716\">716<\/a>.<\/p>","references":false,"refers_to":false,"permalink":{"id":1437501,"object_type":"law","relational_id":361095,"identifier":"37.2-847","token":"37.2\/III\/8\/8\/37.2-847","url":"\/37.2-847\/","edition_id":2,"permalink":0,"preferred":1},"url":"\/37.2-847\/","token":"37.2\/III\/8\/8\/37.2-847","dublin_core":{"Title":"Duty of attorney for Commonwealth","Type":"Text","Format":"text\/html","Identifier":"\u00a7 37.2-847","Relation":"Code of Virginia"},"html":"\n\t\t\t\t\t\t<section><p>In any case to test the legality of the detention of a person pursuant to this article, whether by <span class=\"dictionary\">habeas corpus<\/span> or otherwise, the attorney for the Commonwealth of the county or city in which the <span class=\"dictionary\">hearing<\/span> is held shall, on request of the director of the <span class=\"dictionary\">facility<\/span> or other institution having or claiming <span class=\"dictionary\">custody<\/span> of the person, represent the Commonwealth in opposition to any such <span class=\"dictionary\">petition<\/span>, <span class=\"dictionary\">appeal<\/span>, or procedure for the discharge of the person from <span class=\"dictionary\">custody<\/span>.<\/p><\/section>","plain_text":"                                 CODE OF VIRGINIA\n\nDUTY OF ATTORNEY FOR COMMONWEALTH (\u00a7 37.2-847)\n\nIn any case to test the legality of the detention of a person pursuant to this\narticle, whether by habeas corpus or otherwise, the attorney for the\nCommonwealth of the county or city in which the hearing is held shall, on\nrequest of the director of the facility or other institution having or claiming\ncustody of the person, represent the Commonwealth in opposition to any such\npetition, appeal, or procedure for the discharge of the person from custody.\n\nHISTORY: Code 1950, \u00a7 37-125; 1950, p. 916; 1968, c. 477, \u00a7 37.1-104.2; 1972,\nc. 639; 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"}}