When the governing body of any county or city, pursuant to § 15.2-1638, has purchased or may hereafter purchase any land, a part of which has valuable buildings thereon, whether when so purchased or since constructed, and that portion of the land so occupied by such buildings, or the buildings thereon is, in the discretion of such governing body, not required for the purposes mentioned in § 15.2-1639, such governing body, if deemed proper by it, may either lease such building or buildings for private or other purposes, or remodel and use the same for other public purposes. However, the lease or use shall be first approved by the judge of the circuit court for the county or for the city, as the case may be, and such lease or use shall be terminated when, in the opinion of such judge, the building or buildings or the land occupied by the same, is needed for any of the purposes enumerated in § 15.2-1638.
Va. Code § 15.2-1641