> For AI agents: read the machine-readable documentation index at [https://corpuslaw.us/llms.txt](https://corpuslaw.us/llms.txt) or the single-file full reference at [https://corpuslaw.us/llms-full.txt](https://corpuslaw.us/llms-full.txt).

# Va. Code Ann. § 8.01-662 — Judgment of court or judge trying it; payment of costs and expenses when petition denied

- **Citation**: Va. Code Ann. § 8.01-662
- **Node Type**: section
- **Jurisdiction**: Virginia (state)
- **Code Body**: Code of Virginia (Aug. 2026 snapshot) (Va. Code Ann.)
- **Official Source**: [https://law.lis.virginia.gov/vacode/8.01-662/](https://law.lis.virginia.gov/vacode/8.01-662/)
- **Canonical URL**: [https://corpuslaw.us/codes/virginia/title-8-01/chapter-25/section-8-01-662](https://corpuslaw.us/codes/virginia/title-8-01/chapter-25/section-8-01-662)
- **Semantic URL**: [https://corpuslaw.us/codes/virginia/title-8-01/chapter-25/section-8-01-662](https://corpuslaw.us/codes/virginia/title-8-01/chapter-25/section-8-01-662)

## Hierarchy

Title 8.01 > Chapter 25

## Text

After hearing the matter both upon the response and any other evidence, the court shall either discharge or remand the petitioner, grant him any other relief to which he is entitled, or admit him to bail and adjudge the cost of the proceeding, including the charge for transporting the prisoner, provided, however, that if the petition is denied, the costs and expenses of the proceeding and the attorney fees of any attorney appointed to represent the petitioner shall be assessed against the petitioner. If such cost, expenses, and fees are collected, they shall be paid to the Commonwealth.

When relief is granted upon a petition for a writ of habeas corpus, the order granting relief on the writ shall be served on the respondent and the petitioner. Service may, in the court's discretion, be accomplished by personal service or by transmitting a certified copy of the order to the parties via regular or certified mail, a third-party commercial carrier, or electronic delivery.

Code 1950, § 8-603; 1968, c. 482; 1977, c. 617; 2019, cc. 8 , 48 .
