Specifically, Section 32 of the Offences Against the Person Act 1861, I think you'll find.
32. Placing wood, &c., on a railway, with intent to endanger passengers.
Whosoever shall unlawfully and maliciously put or throw upon or across any railway any wood, stone, or other matter or thing, or shall unlawfully and maliciously take up, remove, or displace any rail, sleeper, or other matter or thing belonging to any railway, or shall unlawfully and maliciously turn, move, or divert any points or other machinery belonging to any railway, or shall unlawfully and maliciously make or show, hide or remove, any signal or light upon or near to any railway, or shall unlawfully and maliciously do or cause to be done any other matter or thing, with intent, in any of the cases aforesaid, to endanger the safety of any person travelling or being upon such railway, shall be guilty of felony, and being convicted thereof shall be liable, at the discretion of the court, to be kept in penal servitude for life … or to be imprisoned …
... 'to be kept in penal servitude for life' ... those were the days, eh?