An empty train travelled along tracks in Belgium for 30 minutes without a driver after the man left his cabin to investigate an engine fault.
The train moved off from the platform at Landen, east of Brussels, and continued for another 12km (7.5 miles) before another driver jumped on board.
Although the train was moving slowly, services on the line were halted.
Officials cleared the next station of passengers and the train was brought under control.
“The train was going very slowly, the platform was clear and the station at Tirlemont (Tienen in Dutch) had been evacuated, so no passengers were ever put in danger,” said Belgian rail operator SNCB (NMBS in Dutch).
The drama unfolded at around 21:00 (20:00 GMT) on Thursday.
When the driver saw the train driving off he alerted colleagues, who then switched signals on the westbound line towards Louvain.
“One of our drivers was able to jump in the driver’s cabin around 21:30 to stop the train,” said SNCB spokesman Bart Crols.
What is unclear is why the train was able to move away without its driver in the first place, which officials say is unprecedented.
The train’s engine system is said to date back to the 1980s and SNCB has said it will conduct a thorough investigation.