If any sheriff or deputy sheriff is arrested or indicted or otherwise prosecuted on any charge arising out of any act committed in the discharge of his official duties, and such charge is subsequently dismissed or there is rendered a verdict of not guilty, such sheriff or deputy sheriff may submit to the governing body of the locality in which he was elected or appointed a statement of legal fees and expenses incurred in his defense of such charge. The governing body may authorize that such legal fees and expenses, or any portion thereof, be paid from the treasury of such locality. If the affected sheriff or deputy sheriff disagrees with the action of the governing body, the officer may petition the circuit court for the county or city to award the fees and cost. The circuit court, sitting without a jury, shall hold a hearing on the matter. The court for good cause shown may order the governing body to pay all or any appropriate portion of the fees and cost.
Va. Code § 15.2-1607