A 70mph passenger train came within inches of hitting a decommissioned ambulance after it crashed through a level crossing barrier when its drugged-up Halifax driver jumped out.
Footage from inside the train driver's cab was shown to a judge at Bradford Crown Court as he sentenced Halifax man Shane Hughes for what he described as the worst case of dangerous driving he had seen in his career at the Bar and on the bench.
Hughes, 41, who had previous convictions for driving while disqualified, had been going to a festival in July when another vehicle he was travelling with was involved in a fatal collision on the A65 near Ingleton.
Hughes, of Ramsgate Street, drove off and was pursued by police vehicles and a police helicopter as he sped through traffic for 37 miles before driving the wrong way round a roundabout as he approached the Kildwick crossing.
Footage from the helicopter, which was also shown in court, captured Hughes jumping out of the still moving ambulance and the empty vehicle going through the barriers and coming to rest across one of the train tracks.
Judge Jonathan Rose was also shown in-car footage from a pursuing police vehicle which filmed the passenger train speeding through the crossing just seconds later with its horn blaring.
Hughes had his head in hands as most of the footage was shown in court, but at one stage he tried to explain that the handbrake had not worked on the ambulance.
MORE CRIME NEWS: READ MORE: Blaze at Ash Green Community School being treated as arson attack
His barrister Stephen Wood said it was clear that a catastrophe was avoided by centimetres that day.
"He understands full well the risks that he created not just for the road users but for the people travelling on that train as well," said Mr Wood.
"He leapt from the ambulance as it was slowing down. He thought the barrier would stop it. It did not, but he has to take responsibility for what ultimately happened."
Hughes, who later tested positive for cannabis, ran off and tried to get a local resident to hand over his car keys by saying he was a police officer.
But his movements were tracked by the police helicopter and he was arrested an officer.
Hughes committed the offences just two days after he was given a community order for another offence of driving while banned.
At an earlier court hearing he admitted charges of obstructing the railway, dangerous driving, driving while banned and theft and today he was jailed for a total of 22 months.
Judge Rose highlighted the fact that the most serious ofences carried maximum prison terms of two years and he was obliged by law to give Hughes one third off his sentence because of his guilty pleas even though everything was captured on camera.
The judge said Hughes had driven the decommissioned ambulance in an utterly disgraceful and appalling manner.
He said he was not dealing with Hughes on the basis that he deliberately drove through the level crossing barrier, but he told the defendant he was the only one to blame for what happened.
Judge Rose said lives would have been lost had the train been travelling on the other track and hit the ambulance.
"This, in my view, is certainly the worst case of dangerous driving I have seen in my career at the Bar and on the bench," he added.
Hughes was banned from driving again for a total of six years and 11 months and he must take an extended re-test at the end of the disqualification period.
"For what it's worth he has told me he has no intention of driving again in the future. Well one hopes that is the case," said Mr Wood.
Keep up-to-date with all the latest news and breaking incidents in Halifax - join our dedicated Facebook group here.