A hurtling locomotive crashed, derailed and caught fire at Cairo's main train station on Wednesday, killing at least 20 people in the latest disaster to strike Egypt's rundown railways.
The country's transportation minister resigned hours after the accident.
The train engine appeared to have slammed into the buffers at the end of the track at high speed, sparking a major blaze that blackened the walls of the Ramses station.
Firefighters were seen hosing down the charred wreckage of the locomotive as security forces guarded the site.
Twenty people were killed and 40 injured, the health ministry said.
Ahmed Ibrahim, a jewellery salesman, said he was on his way to work when he heard a loud explosion.
"I ran to see a lot of people injured. I had to carry a young girl with my own hands," he said, apparently still in shock.
The train driver was arrested and an official investigation is underway, the prosecutor general said in a statement.
It said the driver had left his cabin without turning the engine off, so that the train careered onwards at full speed before smashing to a violent stop.
CCTV footage circulating online showed the locomotive smashing into the barrier without slowing down. People walking on the platform were enveloped by smoke.
Separate footage filmed inside the station showed a fire engulfing the train and a nearby platform and people rushing to help the casualties.
Photos that emerged after the crash showed several scorched bodies scattered around the wreckage.
Several people were seen in videos running around and screaming for help after catching fire.
"I carried around 20 charred bodies to ambulances," said Atef Ahmed Mahmoud from the Nile Delta city of Zagazig.
Later Wednesday, one person was killed and six others injured in another train accident in El-Alamein, near the northern city of Alexandria, state media reported.
Egyptians have long complained that the government has failed to deal with chronic transport problems in the country, where roads are as poorly maintained as railway lines.
Officials often blame the rail network's poor maintenance on decades of negligence and a lack of funds.
President Abdel Fattah al-Sisi called on his government to carry out an investigation and hold those responsible accountable.
Prime Minister Mostafa Madbouli was quick to visit Ramses station and promised a tough response.
"Any person found to be negligent will be held accountable and it will be severe," he said.
Hours later the cabinet announced that Madbouli had accepted the resignation of Transport Minister Hisham Arafat.
People at the site of the crash appeared to be frustrated at the government's failure to revamp the railway network.
"Is my fate to die (on the tracks)? It happens all the time ... what do the authorities do?" asked a man travelling from the Upper Egyptian province of Minya.
The government has repeatedly promised to upgrade the sector especially after several derailments and collisions in recent years.
Egypt signed a deal in 2018 worth one billion euros ($1.14 billion) with a Russian-Hungarian consortium to deliver passenger coaches to the country.
The previous year it signed a $575 million deal with General Electric to purchase 100 locomotives.
Still, figures from the official statistics agency show there were 1,793 train accidents in 2017, up from 1,249 in 2016.
In August 2017 two passenger trains collided near Alexandria, killing more than 40 people and injuring scores.
The next year a train crash in the northern province of Beheira killed at least 15 people and injured dozens more.
Months later Egypt's transportation minister sacked the head of the railway authority after derailments including one that injured some 60 people in Giza.
The deadliest accident on Egypt's railways was in 2002 when 373 people died in a fire that ripped through a crowded train south of the capital.For all the latest business news from the UAE and Gulf countries, follow us on Twitter and Linkedin, like us on Facebook and subscribe to our YouTube page, which is updated daily.
Subscribe to Arabian Business' newsletter to receive the latest breaking news and business stories in Dubai,the UAE and the GCC straight to your inbox.