NEW DELHI - Two passenger trains derailed after flash floods struck a bridge they were crossing in central India, killing up to 27 people in the latest deadly accident on the nation's crumbling rail network.

Rescuers pulled scores of terrified passengers to safety after they became trapped in carriages that toppled over on the weakened and flooded tracks in Madhya Pradesh state, railway and government officials said.

A total of 10 carriages and one engine from the express trains, travelling in opposite directions, were derailed minutes apart outside the town of Harda just before midnight on Tuesday. The government has ordered an inquiry into the accident, but Railways Minister Suresh Prabhu said it appeared the cause was a "flash flood due to heavy rains".

Passengers described how they were jerked awake by the falling carriages, which quickly filled with muddy water.

"I was sleeping and suddenly I felt a jolt. I woke up and saw that all the passengers were screaming and running," Manoj Mongi told the Hindustan Times newspaper's website. "I came out. I saw three women floating but I could not save them," he added. "The water level on the track was almost waist-high," Shashi Bhushan Pandit, another passenger, added.

The Kamayani Express, travelling from the financial hub of Mumbai, came off the rails shortly after a surge of water from the nearby Machak river washed away soil on the small bridge, officials said. The Janata Express, coming the other way from the eastern city of Patna and bound for Mumbai, then crossed over. "The mud from under the tracks was washed away and the tracks were left in the air," Madhya Pradesh Chief Minister Shivraj Singh Chouhan told the NDTV network at the scene.

Minister Prabhu told parliament in New Delhi the number of confirmed deaths so far was only 12, but two officials in Madhya Pradesh put the death toll much higher. State railway police chief M.S Gupta said 27 people had been killed and another 70 injured. "All the coaches have been cleared and all bodies have been collected from inside," Gupta told AFP.

Madhya Pradesh government spokesman Anupam Rajan told AFP that 25 bodies had been recovered.

Television footage showed a line of carriages lying on their sides and on top of each other in a field of mud. Rescuers with specialist cutting equipment were deployed along with doctors. But a passenger told regional TV that "nobody came for us, we were stuck there for three to four hours".

"The train was off the tracks and water was everywhere. And within a second, the whole train derailed and we all got trapped inside."

Officials said rescuers, who worked mostly in darkness through the night into Wednesday morning, were hampered by the waters.

"The entire area has been reeling under heavy rainfall for the last few days. The roads are badly damaged, even the access road," said national railway ministry spokesman Anil Saxena.

Monsoon rains have hit large swathes of the country in recent weeks, flooding rivers and roads and claiming some 180 lives mainly in western and eastern India.

Prime Minister Narendra Modi expressed sadness at the loss of life, adding that "authorities are doing everything possible on the ground".

India's railway network, one of the world's largest, is still the main form of long-distance travel in the vast country, but it is poorly funded and deadly accidents are frequent.

The government has pledged to invest $137 billion over five years to modernise its crumbling railways, making them safer, faster and more efficient.

An express train ploughed into a stationary freight train in May last year in the northern state of Uttar Pradesh, killing 26 and injuring 44 others.