Drone pilots have been warned to keep away from the railway or risk prosecution following an incident involving Flying Scotsman.

Network Rail and British Transport Police issued the alert after footage was posted online appearing to show a drone flying dangerously close to the railway as the world-famous steam locomotive passed through Surrey.

An investigation has been launched into the incident, which happened between Farnborough and Woking on April 12.

Helen Yorke, route crime manager for Network Rail’s Wessex route, said: “This was a very concerning incident which put the safety of passengers, railway staff and members of the public at risk.

“Network Rail has a team of pilots and specialist approved contractors who are the only people permitted to fly drones near the railway.

“We do this as inspecting the railway by air is both effective and efficient in reducing disruption to train services or the need for workers to go trackside.”

Flying a drone near the railway can result in offenders being taken to court and fined up to £2,500.

Railway enthusiasts have been repeatedly warned about the dangers of using the gadgets near Flying Scotsman since it returned to the tracks in February 2016 after a 10-year restoration.

A camera fell from a drone and hit a carriage being pulled by the locomotive near Grosmont, North Yorkshire the following month.

Inspector Andy Jackson from British Transport Police said: “First and foremost, flying a drone near to the railway can be extremely dangerous.

“It is a criminal offence to fly a drone on, over or within 50 metres of the railway and it is important that any would-be drone pilots are aware of this.

“These strict guidelines, put in place by the Civil Aviation Authority, are there to ensure the safety of those who are using the railway, including passengers, rail staff and the pilots of the drones.

“British Transport Police will always conduct vigorous investigations where we have evidence that drones are being flown illegally near the railway.”