At least 20 people were killed and dozens injured when a locomotive smashed through the buffers and burst into flames at Cairo's main train station on Wednesday.
Egypt's public prosecutor said a preliminary investigation indicated the driver stepped off the train to talk to another driver without pulling the hand brake, causing the unattended locomotive to speed off and hit a concrete platform.
Security camera footage from inside the capital's Ramses station showed the train failing to stop as it arrived at platform six, smashing through the buffers and a metal end railing and exploding into a huge ball of fire.
Passengers carrying luggage ran for their lives as the fire spread, and several people were running covered in flames, witnesses said.
Egyptian state television said the train driver had been arrested.
Health minister Hala Zayed said authorities had not been able to identify many of the 20 bodies recovered because they were too badly burned.
Transport minister Hisham Arafat said the train's diesel tank had exploded. He resigned later on Wednesday.
Witness Ibrahim Hussein said: "I saw a man pointing from the locomotive as it entered the platform, and screaming 'There are no brakes! There are no brakes!', before he jumped out of the locomotive. And I don't know what happened to him."
Egypt has one of the oldest and largest rail networks in the region and accidents causing casualties are common. A train collision in Alexandria killed more than 40 people in 2017.
Egyptians have long complained that successive governments have failed to enforce basic safety standards for the railways.
The fire sent smoke billowing above the station. Inside, the train's charred engine could be seen tilted to one side next to a platform.
Bystander Mina Ghaly added: "I was standing on the platform and I saw the train speed into the barrier ... Everyone started running but a lot of people died after the locomotive exploded.
"I saw at least nine corpses lying on the ground, charred."
Zayed said that as well as the 20 killed, 43 people were injured, 15 of whom had been released after treatment. State television had earlier put the death toll at 25 and said 50 were injured.
Ahmed Youssef, a doctor at Al Helal hospital, close to the station, said more than 20 injured had been admitted, most of them in serious condition.
Witness Ahmed Abdeltawab said the platform had been crowded with passengers waiting for another train and people fled in flames.
"The fire overwhelmed them and they ran while they were on fire until they fell metres from the incident," he said. "The scene was terrifying."
Student Ali Ramadan said he had suffered burns and injured his foot when he ran into a concrete bench on the platform. "I don't know when these train accidents will end ... They told us they got millions of dollars' worth of new locomotives and trains, and people are still dying because of train accidents," he said.
Prime Minister Mostafa Madbouly, announced from the station that the incident would be investigated and anyone found responsible would be held to account.
Electricity Minister Mohamed Shaker will take temporary charge of the transport ministry, a cabinet source said.