British Transport Police officers will travel aboard trains being hauled by the world's most famous engine following incidents in England.
The locomotive was due to arrive in Edinburgh today from York and its departure time to Inverness tomorrow is also being withheld to minimise crowds.
The extra security measures will also be in place when Flying Scotsman hauls further excursions between Edinburgh and Fife on Sunday, 19 May, organised by the Scottish Railway Preservation Society.
BACKGROUND: The Flying Scotsman is returning to ScotlandThe National Railway Museum, which owns the locomotive, urged rail enthusiasts to stay clear of the line.
Head of Operations Jim Lowe said: “In response to recent incidents of trespass, we are working with Network Rail and the British Transport Police (BTP) to fit cameras to Flying Scotsman at the earliest opportunity.
"All main line journeys from now on will have BTP officers on board.
“As Flying Scotsman continues its tour around the UK, we would like to remind people wishing to see the famous locomotive to do so safely.
"This means staying back from the platform edge, being aware of other trains that are operating, being considerate to other people and passengers, and keeping well away from the railway track.
"Trespassing on the railways causes delays, endangers lives and is against the law.
"Don’t ruin things for the majority of people who want to enjoy Flying Scotsman and stay safe.”
BACKGROUND: Flying Scotsman to steam round Forth in MayBTP said several people had illegally got onto the tracks near Burton on Trent and Tamworth in the East Midlands last Sunday to try to get a close look at Flying Scotsman.
This had caused "significant disruption" with 56 trains delayed by a total of 16 hours.
The force said two enthusiasts had stood "incredibly close" to the tracks where trains passed at 125mph.
Chief Inspector Gareth Davies said: “It is extremely disappointing that a small minority of rail enthusiasts put their lives in grave danger in an attempt to take photos of Flying Scotsman.
"Quite frankly, they should know better and we are today sending a strong message that this will not be tolerated.
“The railway is an extremely hazardous environment, trespassing could result in serious injury or even death.
"To prevent further incidents, we’re stepping up our patrols when Flying Scotsman is out on the rail network.
"Those caught trespassing or obstructing trains can expect to be prosecuted.”
Steam Dreams, which is operating the Inverness trip, said: While we understand interest in Flying Scotsman will be extremely high, we urge those wishing to view it on its tour dates do so from a safe vantage point.
"It is vital that spectators do not venture onto the railway, particularly when it is on the main line, as a full timetable of regular services will be running.
"In order to avoid overcrowding and incidents of trespass, we are not publishing recommended viewing points or the timetable of when the train will be passing through specific locations."
The firm said previous excursions had been marred by "several dangerous incidents of trespass".
It said: "Members of the public, including those with young children, were seen walking along the tracks and taking photographs of Flying Scotsman while other trains continued to pass on opposing lines."