An incident which saw a Caledonian Sleeper train use an emergency brake after it overran a platform at Edinburgh Waverley Station could have been "much worse" had it collided into another train.

A report from the Rail Accident Investigation Branch (RAIB) found that on August 1 at 7.26am on approach to Edinburgh, the driver discovered that the train's braking performance was well below normal.

The RAIB's preliminary investigation showed that the driver had no control of the brakes on the coaches because a brake pipe isolating valve was in the closed position when the train left Carstairs station.

The only effective brakes on the train as it approached Edinburgh were those on the locomotive, which were insufficient to maintain control of the train.

The Northbound Lowlander service ended up several hundred yards to the east of the station before being stopped at Abbeyhill junction after a train manager used the emergency brake on one of the coaches.

The Caledonian Sleeper blocked a junction, causing disruption and delaying trains to and from North Berwick, Dunbar, Tweedbank and London.

The report said: "The outcome could potentially have been much worse, had it led to a collision with another train."

The investigation will look at how the isolating valve came to be closed at Carstairs; the preparation of the train and testing of the train's brakes.

The train operator issued a safety alert to the industry on August 5, reminding railway staff of the importance of carrying out the brake continuity test after all other train preparation activities.