An overnight train from London carrying 120 passengers had to be halted with an emergency brake after being unable to stop at Waverley Station today.
The incident around 7:30am caused major commuter disruption after the Caledonian Sleeper service came to a halt at a junction in Abbeyhill, blocking the east coast main line.
Operator Serco told The Scotsman tonight: "We can confirm the emergency brake is what brought the train to a halt and was deployed by train manager."
The Sleeper driver is understood to have sent an emergency message to signallers to be given a clear path through the station.
A rail engineer travelling as a passenger witnessed the drama.
Andy Picton, an engineer with South Western Railway who was on the train, tweeted: "Was stood in the vestibule in the coach behind the loco as we flew through Waverley.
"Don't think the loco stopped us, as the guard hit the emergency stop right by us and only then did we come to a halt, that after hitting the one in the guard cabin that didn't seem to work.
"Driver realised there was an issue as he approached Haymarket and couldn't slow down. Unsure if guard aware of prob at that time.
"Was quick thinking by the driver, who phoned through to the signaller as we went through Haymarket and got the route through Waverley cleared to avoid anything more serious. Hats off to him!"
The incident delayed or cancelled LNER and CrossCountry services and about a dozen ScotRail trains to and from North Berwick, Dunbar, Tweedbank and London.
The Scotsman has been told by a source with knowledge of what happened that the fault may have been caused by human error - the brake system not being reset correctly when the Glasgow portion of the Sleeper from London divided from the Edinburgh section at Carstairs in South Lanarkshire.
The source said: "Something was not set up properly that caused the brake issue."
READ MORE: Caledonian Sleeper passengers locked out of Edinburgh Waverley Station
The train was hauled back into the station, where passengers alighted at 8:45am - more than an hour late.
Another passenger, Gerry Carroll, said: "Went very fast through the station, seemed to swerve, then stopped in tunnel for an hour, then reversed out. The crew told us the train had lost power."
An industry source said: "The train was unable to stop at Waverley and came to a halt at Abbeyhill.
"The line through the station was clear and it was well managed."
Another rail source said: "The reaction of the signalling centre upon hearing the emergency radio message and in securing a clear run through a congested Waverley and preventing a collision deserves commendation."
Ryan Flaherty, Serco’s managing director for Caledonian Sleeper, said: “Our northbound Lowlander service into Edinburgh Waverley this morning overran the platform, due to an earlier operational issue at Carstairs.
"An investigation is underway into the cause of the incident, but early indications are that there are no technical problems with the rolling stock.
"We have notified the relevant authorities.
"As a result of the delay, guests disembarked at Edinburgh Waverley at around 8:45am and we’re sorry for the effect this delay had for our guests.
"We anticipate that services will run as normal tonight.”
READ MORE: Anger after Caledonian Sleeper service allows sale of alcohol but not food
A ScotRail spokesman said: "Our services between Edinburgh and North Berwick/Tweedbank were subject to delay and alterations from around 7:30am until around 9:30am.
"Our services have begun to return to normal.
"To keep people moving, we had an agreement in place with selected Borders buses (X95 and X62) and Lothian buses between Edinburgh and Prestonpans.
"For customers in travelling to/from Longniddry, Drem and North Berwick, we arranged replacement buses."
LNER said its Glasgow-Edinburgh-London service was terminated at Edinburgh and others disrupted.
A spokeswoman said: "Some services have started and terminated at Newcastle and others have been diverted via Carlisle.
"We are expecting disruption until 12pm, however service are being reinstated now."
The Transport Salaried Staffs' Association called for the immediate withdrawal of the new Caledonian Sleeper fleet pending the investigation.
TSSA general secretary Manuel Cortes said: “Clearly this is an incredibly serious situation which calls for nothing less than the grounding of the entire new Sleeper fleet until we have the full details of the what went wrong.
“No one should be playing fast and loose with faulty brakes on our railways and Serco need to wake up to that fact and act now.”