A train derailed and set off an explosion and fire in the middle of a small Italian town, killing at least 13 people - many as they slept in their homes - officials said Tuesday. Over 50 people suffered injuries, many severely. The rear of the freight train rammed into a residential neighborhood near the rail station in the town of Viareggio shortly before midnight Monday, after which a car filled with liquefied natural gas exploded, collapsing at least two buildings and setting fire to a vast area. Some 300 firefighters were digging through the rubble of collapsed or burnt homes looking for casualties, amid fears that there could be more victims. As the firefighters worked to contain the blaze, teams specialized in dealing with nuclear, biological and chemical threats were being brought in to prevent the other gas tanks from exploding. Officials said the fire was contained after several hours, but a smell of burning hung in the air. "We saw a ball of fire rising up to the sky," said witness Gianfranco Bini, who lives in a building overlooking the station. "We heard three big rumbles, like bombs. It looked like war had broken out." Some of the victims, including a child, were killed in their homes by the collapses or the fire, said Raffaele Gargiulo, a police spokesman in the nearby city of Lucca, which is in charge of the smaller town of Viareggio. Two drivers who were on the road alongside the tracks when the train derailed were also killed. Others suffered severe burns and died at the hospital. "The condition of the bodies is such that it will be very difficult to identify them," Gargiulo said. The death toll stood at 13 by Tuesday morning, said Gennaro Tornatore, a spokesman for the firefighters. But he said the number of victims might rise as rescue teams searched through the rubble. Lucca's top government official, Prefect Carmelo Aronica, told Italy's RAI state TV that at least 50 people were injured, 35 of whom were hospitalized with severe burns. The ANSA news agency reported that three children were pulled alive from the rubble of their collapsed home shortly before daybreak Tuesday. About 1,000 people were evacuated from their homes as a precaution, town hall officials said. Tents were put up in the area around the town hall. Videos uploaded on YouTube showed a huge plume of fire and smoke towering above Viareggio's low houses. Images from the scene showed an inferno raging in the night, consuming buildings and cars, while the sound of sirens and explosions pierced the air. "It's an impressive scene, there are dozens and dozens of cars hit by the shock wave and collapsed houses," said firefighters spokesman Luca Cari. The 14-car train carrying the liquefied gas was traveling from the northern city of La Spezia to Pisa. The train's two engineers were only lightly injured and were questioned in the hospital, saying they felt an impact some 650 feet (200 meters) outside the station, shortly before the rear of the train flew off the tracks, Gargiulo said. He told The Associated Press by telephone that the incident may have been caused by damage to the tracks or by a problem with the train's braking system.