The rail crash in eastern India which killed more than 300 people and injured hundreds of others was caused by an error in the electronic signalling system which led to a train wrongly changing tracks, India’s railways minister said on Sunday.

“Who has done it and what is the reason will come out of an investigation,” Ashwini Vaishnaw said in an interview with New Delhi Television network.

The explanation came as authorities worked to clear the mangled wreckage of the two passenger trains that derailed in the Balasore district of eastern Odisha state on Friday night, in one of the country’s deadliest rail accidents in decades.

India Train DerailmentPeople look at photographs to identify passengers who were travelling in the derailed trains (Rafiq Maqbool/AP)

The Press Trust of India news agency earlier reported that preliminary investigations had revealed that a signal was given to the Coromandel Express to enter the main track line but the signal was later taken off.

The train entered another line, known as the loop line, and crashed into a goods train parked there, PTI said.

Fifteen bodies were recovered on Saturday evening and efforts continued overnight as heavy cranes were used to remove an engine that had settled on top of a rail car.

No bodies were found in the engine and the work was completed on Sunday morning, said Sudhanshu Sarangi, director-general of fire and emergency services in Odisha.

READ MORE: Long Covid forced more than 2,600 NHS staff to take time off, figures show

 
India Train DerailmentThe scene of the crash in eastern India (Rafiq Maqbool/AP)

The accident happened at a time when Prime Minister Narendra Modi is focusing on the modernisation of the British colonial-era railroad network in India, which has become the world’s most populous country with 1.42 billion people.

Despite government efforts to improve rail safety, several hundred accidents occur every year on India’s railways, the largest train network under one management in the world.

Chaotic scenes erupted on Friday night as rescuers climbed on top of the wrecked trains to break open doors and windows using cutting torches to try to save people who were trapped inside the carriages.

Mr Modi went to the crash site on Saturday to see the relief effort and talk to rescue officials.

He also visited a hospital, where he asked doctors about the treatments being given to the injured, and spoke to some of the patients.

He told reporters he felt the pain of those who suffered in the accident, and said the government will do its utmost to help them and strictly punish anyone found responsible.

READ MORE: The remote Scottish island beaches so covered in waste they look like 'landfill'

APTOPIX India Train DerailmentRescuers recover the body of a victim (Rafiq Maqbool/AP)

Ten to 12 coaches of one train derailed, and debris from some of the mangled coaches fell on to a nearby track.

The debris was hit by another passenger train coming from the opposite direction, causing up to three coaches of the second train to also derail, said a rail ministry spokesman.

In 1995, two trains collided near New Delhi, killing 358 people in one of the worst rail accidents in India.

In 2016, a passenger train slid off the tracks between the cities of Indore and Patna, killing 146 people.

Most rail accidents in India are blamed on human error or outdated signalling equipment.

More than 12 million people take 14,000 trains across India every day, traveling on 40,000 miles (64,000km) of track.