A massive explosion tore through Venezuela's largest refinery on Saturday, killing at least 39 people and injuring more than 80 in South America's biggest oil producing nation, officials said.
President Hugo Chavez declared three days of national mourning, because the tragedy "affects us all, the great Venezuelan family, civilian and military," he said in a telephone call with members of his cabinet.
Among the dead were 18 members of the National Guard -- who were protecting the state-owned refining facility in the northwestern town of Amuay -- 15 civilians and six unidentified bodies, Vice President Elias Jaua said.
Falcon state Governor Stella Lugo had earlier told official television that one of the victims was a 10-year-old child.
Another 82 people were injured, Health Minister Eugenia Sader said.
Fifteen of the injured remain in hospital and are being evaluated, according to Jaua.
Chavez expressed his sympathy to the families of the dead, urging calm because "fortunately, the greatest danger has been controlled."
Ordering a "thorough investigation," he vowed to help the people who have been displaced from their homes at the refinery complex, which also houses workers and their relatives, and in impoverished neighborhoods nearby.
Energy Minister Rafael Ramirez said the explosion was triggered by a gas leak at the refinery, which is owned by state oil firm Petroleos de Venezuela (PDVSA), the cause of which remained to be determined.
"The gas cloud exploded, igniting at least two storage tanks and other facilities at the refinery," he told VTV television.
Ramirez, who is also president of PDVSA, said the refinery was shut down but operations would resume in two days.
The blast damaged 209 homes and 11 shops, while 13 families saw their homes completely destroyed and were temporarily moved to a naval base, according to preliminary figures.
Firefighters were able to bring the fire under control, though smoke was still billowing from the facility.
While officials said there was no risk of another blast, Jaua noted that response units would "continue fighting the flames all night."
Before the blast, the Amuay refinery, one of the biggest in the world, was able to process about 645,000 barrels of crude oil a day.
Venezuelan media has often reported on complaints about safety and maintenance standards at the country's refineries, which authorities have rarely confirmed.
The Latin American nation produces about three million barrels of oil per day, according to state figures, while the Organization of the Petroleum Exporting Countries puts the number at 2.3 million barrels per day.
OPEC certified in 2011 that Venezuela has the largest oil reserves in the world at 296.5 billion barrels, surpassing Saudi Arabia, the country with the biggest refining capacity.
In March, Venezuelan authorities reported even higher reserves, of 297,570 billion.
Venezuelans are gearing up for October 7 elections, in which Chavez -- Latin America's most influential and outspoken leftist leader for more than a decade -- is seeking a third term.
Opposition candidate Henrique Capriles, the youthful former governor of Miranda state, has trailed Chavez in recent polls by some 15 percentage points.
If Chavez, who has declared himself "free" of cancer a year after his diagnosis, wins and serves out his full term, he could rack up 20 years in office.