NEW DELHI — Two trains collided in eastern Bangladesh on Tuesday, killing at least 16 people and injuring dozens more, officials said.

Shariful Alam, a spokesman for Bangladesh’s railway department, said the collision on Tuesday occurred around 3 a.m. in the district of Brahmanbaria, where the Turna Nishita train, which was heading to Dhaka, the country’s capital, smashed into the Udayan Express, a train heading in the opposite direction.

Mr. Alam said the conductor of the Turna Nishita, who survived the accident, failed to heed a stop signal when he rammed into one of the other train’s passenger compartments, where many people were sleeping.

“We were so close to death, but God saved us,” Mohammad Moslem, 50, a passenger on one of the trains, told Reuters, adding that when he came out of the train, many of the bodies were missing limbs.