Whenever in the discretion of the court it is necessary for the safekeeping of a prisoner under charge of or sentence for a crime, whether the prisoner be in jail, hospital, court or elsewhere, the court may order the sheriff to summon a sufficient guard. Whenever ordered by the court to do so, the sheriff shall summon or employ temporarily such persons as may be needed to preserve proper order or otherwise to aid the court in its proper operation and functioning. For such guard or other service the court may allow 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 such person. A prisoner may be charged reasonable fees for providing him a security escort, supervision and transportation to and from a funeral or graveside service.
Va. Code § 53.1-93