A Sydney passenger train driver who had been awake for 21 hours was under pressure from controllers when he steered the train in the wrong direction towards an oncoming freight train in the city's west.
Safety investigators also discovered that a guard on the Waratah train realised it was heading the wrong way from Mount Druitt station in March last year but he didn't do anything.
Instead of heading to St Marys, the train travelled towards Blacktown, putting it on a collision course with a Pacific National freight train, which was just four kilometres away on the same line.
The driver brought the train to a halt only after one of Sydney Trains network control officers phoned him urgently to tell him to stop.
The driver and the guard were the only people on the train at the time of the incident in the early hours of the morning on March 12.
In a final report released on Friday, the Australian Transport Safety Bureau found that Sydney Trains' fatigue management processes were ineffective in identifying the symptoms of the driver who had been awake for more than 21 hours and had a high workload.
Investigators found the driver felt under pressure to get the train moving and was distracted because he had spent more than three hours at Mount Druitt station on other tasks before he started driving.
In a sign of the pressure, a network control officer told the guard shortly before the train departed: "It's getting critical, we need him to move."
The driver, who had worked for 12 of the previous 14 days, told investigators that he "felt drowned, exhausted in the cab" at the time of the incident.
"This case should serve as an opportunity to review the rostering of train crew, especially those called in on the stand-by roster," investigators said in the report.
The guard, who was less experienced than the driver, took no action when the train started heading in the wrong direction because he thought the driver might have received clearance from controllers to travel towards St Marys instead of Blacktown.
The incident occurred after the driver and guard had been called in to take over from a crew who had been forced to stop at Mount Druitt when a storm partially closed the line between Blacktown and Penrith.
The replacement crew confronted a multitude of problems that included supply cuts to the overhead electrical wires, difficulties logging into a computer system and the train's radio on the blink.
In an effort to fix the problems with a technician, the driver walked to either end of the eight-carriage train seven times in the space of three hours, which investigators said probably disorientated him.
Since the incident, Sydney Trains has begun a review of rostering of train crews and is looking at whether an extra assessment of fatigue is conducted of drivers who are called in at late notice.