Two rail workers jumped from a runaway train which travelled for four miles after hitting a tree, accident investigators said.

The 40mph collision near Markinch station in Fife disabled the maintenance train’s brakes, according to a preliminary report by the Rail Accident Investigation Branch (RAIB).

The train came to a rest after reaching an uphill section of track, but then rolled backwards. After making an emergency call on the train radio, the crew jumped onto the trackside, suffering minor injuries.

The train eventually stopped at a low point near Thornton North Junction after rolling forwards and backwards several times.

It was being used to clear leaves from the track at around 4.25am on October 17.

The driver saw the tree shortly before impact and applied the emergency brake. Damage to the underside of the train caused the brakes to be “irreversibly released”, the RAIB said.

A full investigation will look in more detail at the circumstances and effects of the incident.