When it shall appear to the circuit court of any county or city that there is no jail therein or that the jail of such county or city is insecure, out of repair or otherwise inadequate, it shall be the duty of such court to award a rule in the name of the Commonwealth against the governing body of the county or city to show cause why a writ of mandamus should not issue commanding the governing body to erect a jail for the county or city, or to cause the existing jail of such county or city to be made secure, put in good repair, or rendered otherwise adequate, as the case may be.
Va. Code § 53.1-71