A spokesman said: “RAIB inspectors were deployed to Stonehaven to gather evidence as part of a preliminary examination following the derailment of a train.”

A Network Rail spokesman added: “Rail Accident Investigation Branch investigations have reached a point where we can begin the task of rerailing the train.

“Once rerailed and clear of the site, we will then assess damage to the track and estimate how quickly we can repair damage and get trains moving again.”

The spokesman said when services would resume was dependent on any repairs to be carried out. Network Rail added workers had been at the site during the night to try to get trains running again.

Train operator ScotRail said: “Once the train has been removed, we’ll need to inspect the track for damage and make repairs.”

Stonehaven and Lower Deeside councillor Wendy Agnew said: “I think it will have inconvenienced quite a lot of commuters as a lot of people here travel by train.

“It would be interesting to find out how it happened. I hope there’s no reoccurrences.”

North East region Scottish Conservative MSP Tom Mason added: “The derailment caused massive disruption to many lives across the north-east. But it’s a relief no one was hurt and there needs to be time to examine why this happened. As a regular user myself, I look forward to the newly refurnished trains, shorter journey times and I hope a more reliable service.”