A major steam train operator has been ordered to pay more than £260,000 after admitting health and safety breaches that led to a high-speed near miss.
The West Coast Railway Company admitted two charges under the Health and Safety at Work Act following the incident at Royal Wootton Bassett, Wiltshire, on March 7 last year.
Melvyn Cox, 67, a driver for the company, also pleaded guilty to two charges and was handed a four-month prison sentence, suspended for 18 months.
Swindon Crown Court heard the steam locomotive Tangmere, driven by Cox, passed a signal at danger after a safety system that automatically applies an emergency brake was deliberately disabled.
The train, with 477 passengers and 39 staff on board, came to a halt almost 700 metres after the signal, leaving it straddled across a junction on the Great Western main line.
A high-speed London-bound train, carrying 240 passengers, had passed over the junction a minute before Tangmere, the court heard.
Judge Peter Blair QC said: "A collision thankfully didn't occur. Nobody disputes that the result could have been catastrophic. There would have been catastrophic injuries had there been a collision of the sort that one fears."
The judge ordered Cox, of Swanage, Dorset, to pay a victim surcharge and carry out 80 hours of unpaid work.
"He knew of the rules and he intentionally breached them and flagrantly disregarded them so as to make life easier for himself as a driver with the potentially catastrophic consequences that could have meant," the judge said.
Mark Harris, prosecuting for the Office of Rail and Road, told the court that drivers could disable the two safety systems on the train through a lever.
Cox was driving with his head out of the window of the cab due to a steam leak when a horn sounded to signal a temporary speed restriction on the line.
The court heard drivers must acknowledge the warning by pressing a button within 2.7 seconds but Cox took 4.2 seconds - meaning the braking system was activated.
Rules say drivers must allow trains to stop when braking is triggered and inform the signaller but Cox instructed a colleague to disable the system.
The horn sounded a second time for a yellow warning - informing the train that the next signal was red and to start slowing down - but Cox believed it was for the temporary speed restriction.
Tangmere continued towards the junction at 53mph and Cox missed a red warning light inside the cab as his head was out of the window, so did not slow down.
"He applied the emergency brake just before 5.30pm but because Tangmere was travelling at an excessive speed and it is an extremely heavy locomotive it didn't stop before it had passed the signal," Mr Harris said.
"A London-bound train with 240 passengers had passed over the junction a minute before Tangmere stopped across it. Therefore a collision was only narrowly avoided with the potential consequences that can be imagined."
Cox, a train driver for more than 40 years, informed the signaller of the incident and was relieved of his duties when he arrived at Swindon.
In interview after the incident, Cox claimed it was "common practice" for drivers to turn off the safety system, adding he was under constant pressure for timekeeping by his employer.
The judge ordered the West Coast Railway Company to pay £200,000 in fines and £64,000 in prosecution costs.
Representing the company, David Travers QC said systems had been implemented following the incident to improve safety.
Mark Watson, for Cox, said: "It was a brief moment of madness in an otherwise diligent career in the railway industry."
Speaking after the case, Ian Prosser, HM Chief Inspector of Railways, said: "Rail safety remains one of the regulator's key priorities and we will always take action against companies or individuals if failings are found."