SCOTRAIL have launched an investigation into allegations that a driver fell asleep at the controls of a train heading to Edinburgh.

The train was travelling at speeds of between 50 and 60mph from Fife on Tuesday morning when an amateur photographer took pictures of the Scotrail train from a bridge near Edinburgh Airport.

The photographer is said to have shot three frames over the space of a couple of seconds where there was allegedly no change to the driver’s pose, which was with eyes apparently closed and head tilted to the side.

ScotRail trains are fitted with various safety systems including emergency automatic braking systems that kick in if the driver does not respond within a few seconds. They are also fitted with data recorders, much like 'black boxes' on aircraft.

A ScotRail source initially said that they were not actively looking into the what happened, saying that if the emergency braking system had been activated it would have triggered an "operational incident" that they would have be aware of and that it was "exceptionally unlikely" that the driver would have been asleep.

A ScotRail spokesman later said: "Following the Herald sharing photographs of one of our drivers, we take any allegations seriously and are carrying out an internal investigation. However, if there is no driver activity in the train cab a safety device in the cab activates and applies the train brakes."

The train, one of Scotrail's fleet of 158 Express Sprinters, had been heading in the direction of Edinburgh’s Waverley Station from Dalmeny in Fife when the shots were taken at around 10.25am.

The photographs were taken by a member of the public who had planned to take photographs at Edinburgh Airport but fired off some test shots of the train before arriving.

In October, 2016, a Rail Accident Investigation Branch report revealed that drivers on one of Britain’s busiest rail lines have been dozing off at the controls because their company rest area was not “fit for purpose”.

Two freight train drivers went through signals in Berkshire because they “momentarily fell asleep” and were only brought to a halt by an emergency automatic braking system. One driver hadn’t slept for 19 hours.

The report warned it was too noisy at a rest area at the drivers’ depot where they can nap mid-shift.

In one case the freight train was left in the path of an oncoming high speed train - luckily empty - which was automatically halted by another signal returning to red.

The RAIB investigation was launched after two similar incidents were reported during 2015.

The first happened when a service from Acton to Westbury, passed a signal at danger at Reading Westbury Line Junction.

And in November another freight train, operated by the same company, passed a signal at danger at Ruscombe Junction, about seven miles east of Reading.

Both drivers were alerted by warning horns and managed to slam on their emergency brakes.