When a person is in jail or under a recognizance to answer a charge of assault and battery or other misdemeanor, or has been indicted for an assault and battery or other misdemeanor for which there is a remedy by civil action, unless the offense was committed (i) by or upon any law-enforcement officer, (ii) riotously in violation of §§ 18.2-404 to 18.2-407, (iii) against a family or household member in violation of § 18.2-57.2, or (iv) with intent to commit a felony, if the person injured appears before the court which made the commitment or took the recognizance, or before the court in which the indictment is pending, and acknowledges in writing that he has received satisfaction for the injury, the court may, in its discretion, by an order, supersede the commitment, discharge the recognizance, or dismiss the prosecution, upon payment by the defendant of costs accrued to the Commonwealth or any of its officers.
Va. Code § 19.2-151