Updated

A natural gas tanker truck lost control and exploded on a highway lined by homes in the Mexico City suburb of Ecatepec early Tuesday, killing at least 20 people and injuring nearly three dozen, according to the Citizen Safety Department of Mexico State, which surrounds Mexico City.

Officials did not rule out the possibility the death toll could rise more as emergency workers continued sifting through the charred remains of vehicles and homes built near the highway on the northern edge of the metropolis.

Residents pitched in to rescue people from the wreckage of the 5:30 a.m. explosion, crushed and burned cars and shattered homes. Television footage showed plumes of flame shooting out of homes in the pre-dawn darkness.

A huge piece of the truck's gas tank was blown 50 yards by the force of the blast, landing atop the wall of a house and cars parked outside.  A number of pigs and other farm animals that were kept on patios were killed.

"It was thunderous sound. I thought we were all going to die," said Rita Enriquez, 42, a housewife who lives near where the blast occurred. "When we ran out, we saw a car on fire and flames everywhere. Smoke was pouring all over the freeway."

Enriquez said five of her relatives were gravely injured in their concrete slab home along the freeway, though she had no other details as she waited for word outside Magdalena Las Salinas Hospital in Mexico City.

Her 15-year-old niece, Wendy Garrido, who was pregnant, was forced to give birth in the aftermath of the explosion, she said.

Cesar Gomez, Mexico state health secretary, said the injured people receiving care at Magdalena had burns over at least 70 percent of their bodies. He said the teenager and baby survived, but both are in intensive care. More than 20 remained hospitalized at various facilities by Tuesday afternoon, eight in grave condition.

Gomez said some of the victims may be airlifted to Texas for burn treatment.

The driver, Juan Olivares, 36, was heading to Mexico City from Pachuca, a city to the north, when he hit the center divider, said Jose Luis Cervantes, assistant prosecutor for the state of Mexico. The tractor carrying two gas tanks broke apart, with one flying into a house and exploding, killing 15, and another part of a tank hitting a separate house, killing four. Cervantes did not say where the 20th person died.

He said the driver may face manslaughter and property damage charges.

"We just pulled burned people, and put out the fire in the houses, but we don't really know what happened," said Rogelio Martinez, a resident of the neighborhood where the crash occurred.

Emergency personnel at the scene pulled dead victims from their homes, some apparently burned in their beds. An Associated Press journalist at the scene saw rescue workers carry three bodies, covered with white sheets, from one home.

One small passenger van had been totally gutted by flames and tossed against the wall of one of the many improvised houses built next to the highway.

Hundreds of police, ambulance drivers, paramedics, soldiers and firefighters gathered at the scene.

Pablo Bedolla, the mayor of Ecatepec, a mainly working-class area, said 20 homes and one school had been damaged in the blast. The explosion happened before class hours, so there were no apparent injuries in the school.

"People are very shaken, above all because of the injuries and the large number of dead," said Bedolla. "I've spoken with the families of the victims, and they are just sobbing."

The explosion closed the highway between Mexico City and Pachuca for hours.

The pre-dawn accident exposed two recurrent public safety issues in Mexico: extremely heavy trucks that are frequently involved in serious accidents, and the construction of improvised homes just feet away from major highways.

Some of the cinderblock homes hit by the massive explosion were just steps away from the busy, eight-lane highway. Other homes were mere shacks, built of sheet tin.

Speaking in Mexico City, President Enrique Pena Nieto suggested something would have to be done to separate major highways from poor neighborhoods.

"I have instructed the Transportation Department ... to review the safety conditions on this federal highway in places where structures have been built on the right of way, so that in the near future, work can be carried out to make it safer," Pena Nieto said.

Often in Mexico, squatters settle on the right of way, the strip of land on either side of a highway or railway line, and put shacks there, gradually building up neighborhoods that are inherently unsafe, because they are built in what was intended to be a buffer zone.

This highway, however, was recently expanded, so it was unclear whether the land was legally settled.

Mexican trucks, often overloaded or unsafely operated, have been involved in a number of spectacular, deadly accidents in recent years.

The truck involved in Tuesday's accident was a double tanker: one cab pulling two gas tanks. The driver was injured in the crash, and was under detention at a local hospital.

One year ago, the Mexican government announced measures to tighten inspections and lower maximum allowed weights for freight trucks after protests over a string of deadly accidents involving double-trailer trucks.

Mexico had allowed trucks to travel two-lane roads with loads of up to 80 metric tons and lengths exceeding 100 feet, compared to a U.S. limit of is 80,000 pounds (40 tons) on interstate highways. It subsequently reduced that limit by about 4.5 tons.

In April 2012, a double-trailer truck on a two-lane road in the Gulf coast state of Veracruz lost its rear trailer, which slammed into a bus carrying farm workers, killing 43 people.