In any case in which a person is convicted of a violation of § 18.2-346 or of a misdemeanor violation of § 18.2-347, 18.2-348, or 18.2-349 and where a city or county farm or hospital is available for the confinement of persons so convicted, confinement may be in such farm or hospital, in the discretion of the court or judge.
Va. Code § 18.2-350