Any person who goes upon the track of a railroad other than to pass over such road at a public or private crossing, or who willfully rides, drives or leads any animal or contrives for any animal to go on such track except to cross as aforesaid, without the consent of the railroad company or person operating such road, shall be guilty of a Class 4 misdemeanor. A second violation of the provisions of this section occurring within two years of the first violation shall be punishable as a Class 3 misdemeanor. A third or subsequent violation of the provisions of this section occurring within two years of a second or a subsequent violation shall be punishable as a Class 1 misdemeanor. This section shall not apply to any section of track which has been legally abandoned pursuant to an order of a federal or state agency having jurisdiction over the track and is not being used for railroad service.
For purposes of this section, track shall mean the rail, ties, and ballast of the railroad.
Va. Code § 18.2-159