A train conductor was seriously injured when he was struck in the face by a brick, it has emerged.
Train passengers are being placed at risk, it is warned
The man received hospital treatment for facial injuries after being injured on the Edinburgh-bound train.
The incident was highlighted by Network Rail as its regional director Ron McAulay spoke out on the dangers posed by vandalism on the railways.
He said that stone throwing, vandalism and deliberate blocking of lines could have "horrific consequences".
Other recent incidents included a man who was reported to be carrying a shotgun beside the railway in Wallyford, East Lothian.
Three youths were caught by British Transport Police after rail staff reported seeing them throwing stones at overhead power lines at Larkfield.
It is estimated that rail crime in Scotland costs the industry £10m each year.
"This is a very serious problem and we need to look at ways of stopping the individuals behind these foolish and thoughtless acts," said Mr McAulay.
"It is a worrying problem for the whole rail industry and the scale of this problem cannot be underestimated.
"Trespass and vandalism is a punishable offence and I would call upon the public and the authorities to be aware of these issues and work with us to help stamp this out".
He added that there was "no excuse" for such behaviour.
"Vandals are risking the lives of train passengers by deliberately blocking lines, throwing stones and vandalising the network," he said.
"Incidents of this nature can have horrific consequences."