Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

NEW DELHI — A train came off the tracks in northern India on Saturday, killing about 20 people and injuring scores more, as carriages slammed into each other, officials said.

Rescuers and local people worked into the night searching for survivors in the overturned and mangled carriages, some piled on top of each other. The death toll in the northern state of Uttar Pradesh was expected to rise, officials said.

Railway police and local volunteers look for survivors in the upturned coaches of the Kalinga-Utkal Express after an accident near Khatauli. AP

At least eight carriages derailed in the crash close to Muzaffarnagar, about 80 miles north of the capital New Delhi, as the train traveled toward the Hindu holy city of Haridwar, police said.

Train crashes are frequent in India, which has the world's fourth biggest rail network. Poor investment in past decades in the vast network and rising demand means overcrowded trains are running on creaking infrastructure.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Saturday's accident is at least the fourth major passenger train derailment this year and the third in Uttar Pradesh in 2017. A crash in November in Uttar Pradesh killed 150 people.

A senior police officer in the state, Anand Kumar, said close to 20 people had been killed and more than 80 injured.

Sanjeev Balyan, a Muzaffarnagar lawmaker, had earlier told Reuters that at least 14 people had been killed.

"We are struggling to pull out injured, and are waiting for gas cutters to arrive. It's too dark to launch a full fledged search operation, but our teams are trying their best," said Ajay Pandey, a senior police officer at the site.

The national authorities sent disaster teams to help.

Indian Prime Minister Narendra Modi sent a message on Twitter saying he was pained by the derailment of the Utkal Express, offering condolences to families of those killed and wishing a speedy recovery to the injured.

In June, Reuters reported that a planned $15 billion safety overhaul of India's rail network was facing delays as the state steel company could not meet demand for new rails.

The network is in the middle of a $130 billion, five-year modernization. The government launched the additional safety overhaul program in February to tackle a surge in train accidents in the past two years blamed on defective tracks.

A senior official in the Uttar Pradesh government, Arvind Kumar, told the Hindustan Times the train driver had slammed the brakes on after spotting maintenance work on the tracks that was not properly signaled, the newspaper reported.

Anil Saxena, a spokesman for the railways, said it was too early to speculate about the causes of Saturday's crash.