Network Rail and rail services company Amey have been fined a total of £500,000 over the partial derailment of a high-speed train in west London.
A carriage from a First Great Western train came off the tracks
No-one was injured when the Swansea to London express derailed at 120mph near Southall station in November 2002.
The firms pleaded guilty at the Old Bailey to exposing 450 passengers to risks by not maintaining the track.
Network Rail was fined £200,000 and Amey £300,000. They were both ordered to pay costs.
Judge Richard Hone said the accident happened when a metal plate, at a crossing, split and part of it became lodged in the track.
The court heard Network Rail had not supervised the work properly and Amey had not ensured the track was properly maintained.
The wheels of one of the eight coaches came off the track as the 0805 GMT train travelled through Southall station.
The train remained upright and kept going for two miles, stopping just outside West Ealing station.
Judge Hone said: "It must have been exceptionally frightening for the 450 fare-paying passengers, not to mention the frustrating inconvenience of a two-and-a-half-hour evacuation.
"Remarkably and mercifully, no passenger was physically injured."
He added that since 2002 "great expertise had been brought to bear on how to improve the system".
Although the case was brought by the Health and Safety Executive, in April 2006 the Office of Rail Regulation became the health and safety regulator for the rail industry.
An official report found it was an "unlucky and unpredictable event".