The accident occurred in the early hours of the morning near the town of Nellore
Thirty-two people were killed Monday when an overnight fire ripped through a coach of an express train as it carried sleeping passengers to the southern Indian city of Chennai, officials said.
The accident, on a long-distance service from New Delhi, occurred in the early hours of the morning near the town of Nellore in Andhra Pradesh state with an electrical short-circuit seen as the most likely cause.
Images showed dozens of rescuers, survivors and crowds of onlookers milling around as the blackened and twisted bodies of victims, some burnt beyond recognition, were lifted out and laid in rows alongside the railway line.
Family members of the victims wailed and screamed, while other dazed survivors sat around quietly with their belongings.
"I woke up when people were rushing into our compartment, I was in S-10 which was attached to the S-11 coach that caught fire," passenger Shantanu, who gave only one name, told the NDTV news channel.
"There was smoke all around. We tried to open the emergency window, people jumped out of it."
The central government press office said that 32 people had lost their lives and 25 had been injured, with 500,000 rupees (9,000 dollars) offered to the families of the deceased.
Nellore chief district official B. Sreedhar said preliminary investigations suggested a short circuit near a toilet had triggered the blaze, while Railway Minister Mukul Roy said an investigation was underway.
"Nothing can be excluded and nothing can be said without an investigation," Roy told reporters shortly before rescue officials wrapped up their nearly 12-hour search for bodies.
The train was travelling at 110 kilometres per hour (70 miles per hour) when it passed through Nellore station, where staff noticed the fire and informed the railway authorities.
The burning carriage was quickly detached from the rest of the train which prevented the fire from spreading.
India's accident-prone rail network is still the main form of long-distance travel in the huge country despite fierce competition from private airlines.
While new shiny airport infrastructure is springing up, the Indian railways -- a much-romanticised legacy of British colonial rule -- often appear stuck in a time-warp.
There were two fatal accidents this May alone, including a collision that killed 25 people near the southern city of Bangalore. Four passengers also died after a train derailed in the northern state of Uttar Pradesh.
Prime Minister Manmohan Singh sent his condolences over the deaths and has asked the national railways ministry to coordinate the relief effort, his office said.
In March, the then railway minister Dinesh Trivedi unveiled a draft budget for 2012-13 that included a major safety upgrade to be financed by across-the-board fare hikes.
But he was forced to withdraw it and resign after a rebellion from his own populist party, the Trinamool Congress, which objected to increasing ticket prices for the poorest travellers.
The National Crime Records Bureau, which gathers the causes of fatalities across India, says 25,705 people in total died on the railways in 2009.
The data is not broken down, but a vast majority of these deaths are people falling from the open doors of carriages or being hit on the tracks, which are mostly unsecured.
India's worst rail accident was in 1981 when a train plunged into a river in the eastern state of Bihar, killing an estimated 800 people.