A train conductor has been fined £400 after being caught drunk on duty at Edinburgh's main railway station.
Hundreds of passengers were stuck on board when the train doors remained locked after arriving at Waverley Station earlier this month.
A frantic search by rail staff found Thomas Gracie, 40, asleep in the cab and the emergency door opening had to
be used to let the passengers off.
When Gracie was finally awoken, he almost staggered onto the rail tracks.
The transport worker, of Morrison Crescent, Edinburgh, pleaded guilty at Edinburgh Sheriff Court today to being more than three times over the drink-drive limit while at work.
Fiscal depute Tom Crosbie said Gracie had appeared to be fine when he turned up for work on August 8.
But it was when he was in charge of the 7.33pm Scotrail service from Dunblane to Edinburgh when his drinking came to light.
"The day passed uneventfully until shortly after 8.30pm when the train doors failed to open on arrival at Edinburgh Waverley and passengers were unable to get off the train," said Mr Crosbie.
"A cleaner attended at the conductor's cab and observed (Gracie) was asleep.
"He was unable to be awoken and the emergency release was activated to allow access to the cab.
"He was eventually forcibly shaken and did wake up.
"There was a strong smell of alcohol noticed on his breath and he immediately staggered onto the platform and had to be restrained to stop him staggering on to the tracks.
"He was supported by other members of staff on the way to the office and admitted to having been drinking," Mr Crosbie added.
Charlotte Ludgate, defending, said Gracie had been diagnosed with an illness and a close friend had recently died of the same illness.
He had lost his job with Scotrail because of the incident and was now in debt.
"Mr Gracie accepts that he went into work drunk on this occasion," said Miss Ludgate.
"He's ashamed of himself and accepts that he has a drink problem.
"It stems from a diagnosis he had two-and-a-half years ago.
"In the week running up to the offence a very close friend had died of the same illness and he was in a very emotional and grief-stricken state," she added.
Sheriff Nigel Morrison QC said he had reduced the fine from £600 because Gracie had admitted the offence.