At least 20 people were killed and 43 injured when a locomotive smashed through the buffers at the main train station in the Egyptian capital Cairo on Wednesday, the health minister said.

Transport Minister Hisham Arafat resigned after the incident, the cabinet said in a statement. State television said authorities had arrested the train driver.

Footage circulating on social media from a security camera inside the 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.

The health minister, Hala Zayed, said authorities had not been able to identify many of the 20 bodies recovered because they were too badly burned.

Egyptians have long complained that successive governments have failed to enforce basic safety standards for the railways.