An express train has slammed into a parked freight train, killing at least 40 people in northern India, officials have said.

The collision on Monday caused six cars of the Gorakhdham Express passenger train to derail in Sant Kabirnagar district of the northern state of Uttar Pradesh, Railway Ministry spokesman Anil Saksena told the Associated Press.

The express was travelling from Hisar city to Gorakhpur city in northern Uttar Pradesh and crashed at Chureb station in Khalilabad, according to the AFP news agency.

Live Box 2013927135832671882

Rescuers were working to free people trapped under toppled cars and broken metal debris.

Television footage showed at least one carriage on top of another mangled one, with windows shattered and locals gathering nearby.

Narendra Modi, who was sworn in as India's new prime minister on Monday, expressed his sadness at the loss of life.

"My condolences to families of those who lost their lives in the Gorakhdham express tragedy. Prayers with the injured," Modi said on his official Twitter account.

"Spoke to the Cabinet Secretary. Asked him to take an overview of the situation & ensure timely assistance to those injured," he said.

Accidents are common on India's railroad network, one of the world's largest, with 23 million passengers daily riding on about 11,000 passenger trains. Most collisions and fires are blamed on poor maintenance and human error.

Earlier this month, a train crashed into a jeep on an unmanned railroad crossing in Uttar Pradesh, killing 13 members of a wedding party.

Source: Agencies