An off-duty rail worker walked a mile to raise the alarm after surviving the train derailment which killed three people, it has emerged.
Driver Brett McCullough, conductor Donald Dinnie and passenger Christopher Stuchbury died in the incident near Stonehaven on Wednesday.
Two investigations have begun into the derailment, believed to have been caused by a landslip after heavy rain.
Prince Charles is visiting the area to thank the emergency services.
He met some of those who were among the first on the scene of the crash on Friday morning.
Transport Secretary Michael Matheson told BBC Scotland’s The Nine that a “number of actions” were taken after the derailment to raise the alarm.
He said: “There was a call made by someone who believed that an incident had taken place locally and they contacted Police Scotland.
“There was also an off-duty railway person on the train who, after it derailed, walked around a mile to the next signal box and advised them that an incident had occurred, which allowed Network Rail at its national control centre to close the line.
“During the course of that, Police Scotland obviously dispatched their staff and Network Rail dispatched some of the staff that they had working nearby to respond to the incident.”
It is thought that the 06:38 Aberdeen to Glasgow Queen Street service was derailed by a landslide after heavy rain in the area.
The train, which had passed through Stonehaven before 07:00, had turned back and was heading towards Aberdeen at the time of the crash.
The alarm was raised at about 09:40 on Wednesday morning.
Mr Matheson said it would not be appropriate to speculate about what had happened during that intervening period.
“That is one of the very specific areas that the investigators will look into,” he said.
He said he wanted answers “sooner rather than later”.
The families of three men killed in a train derailment in Aberdeenshire earlier told of their devastation at their deaths.
Six others who were on the train were taken to Aberdeen Royal Infirmary. Four have since been discharged, while the other two patients were said to be in a stable condition.
First Minister Nicola Sturgeon said the “hearts of a nation” were with those affected.
UK Transport Minister Grant Shapps has asked Network Rail to produce an interim report by 1 September.
He also said he spoke with PC Liam Mercer, the first officer on the scene, and commended him for his bravery.
Network Rail said it would carry out detailed inspections of high-risk trackside slopes with similar characteristics to the site of the Aberdeenshire crash.
Dozens of sites across Britain will be assessed using in-house engineers, specialist contractors and helicopter surveys.
Scotland’s Lord Advocate has asked Police Scotland, British Transport Police and the Office of Rail and Road, the independent regulator, to conduct a joint investigation into the accident.
This will run in parallel with the independent safety investigation being carried out by the Rail Accident Investigation Branch.