Whenever in the discretion of the court it is necessary for the safekeeping of a prisoner under charge of, or sentence for, crime, whether the prisoner be in jail, hospital, court or elsewhere, the court may order the jailer to summon a sufficient guard, and whenever ordered by the court to do so, the sheriff of any county or city shall summon or employ temporarily such person or persons as may be needed to preserve proper order or otherwise to aid the court in its proper operation and functioning, and for such guard or other service the court may allow therefor so much as it deems proper, not exceeding the hourly equivalent of the minimum annual salary paid a full-time deputy sheriff who performs like services in the same county or city; in addition, mileage and other expenses for rendering the services shall be paid for each person, the same to be paid out of the budget allotted to the sheriff as approved by the Compensation Board, except when payment for such guard is otherwise provided under the provisions of § 53.1-94 of the Code of Virginia.
Va. Code § 19.2-328