MEXICO CITY — Mexico’s president vowed on Saturday to redouble his fight against an epidemic of chronic fuel theft after thieves punctured a gas pipeline north of Mexico City, causing an explosion that killed at least 21 people and injured 71 others.
The blast underscored the deadly perils of the fuel-theft racket, which has cost the government billions of dollars a year and has been the target of a weekslong crackdown by the administration of President Andrés Manuel López Obrador.
“We will continue and strengthen the fight against the illegality and the oil theft,” the president told reporters during a visit to the site of the explosion. “We will carry on until we eradicate this practice.”
The explosion, which occurred on Friday night along a pipeline in a rural part of the state of Hidalgo, was particularly deadly because the promise of free gasoline had drawn scores of residents to the breach in the pipeline.
Videos taken before the blast showed a raucous atmosphere, with villagers from the rural municipality of Tlahuelilpan, including families, whooping and laughing as they filled plastic jugs, pails and canisters with the gasoline, which gushed from the break like a geyser.
In the footage, military personnel who had rushed to the scene can be seen standing by and observing the throng that had converged on the pipeline, which runs from the nearby Tula refinery operated by the government-run oil firm Petróleos Mexicanos.
Mexico’s secretary of public security, Alfonso Durazo, told reporters that there had not been enough military personnel to turn back so many people and cordon off the site.
About two hours after the authorities learned of the break, the fuel ignited, causing a huge explosion and sending flames and clouds of smoke into the sky. Videos and photographs circulating on social media and broadcast on Mexican news channels showed people engulfed in fire running away from the blaze and victims screaming in pain and wailing for help.
The fire took more than four hours to extinguish.
It was perhaps the deadliest pipeline explosion in Mexico since 2010, when at least 27 people were killed, scores injured and numerous homes destroyed in a blast in San Martín Texmelucan de Labastida, a city in the state of Puebla. That, too, was caused by an illegal siphoning effort, officials said.
Friday’s inferno came amid a major crackdown by the López Obrador administration, whose strategy has included diverting flows away from the pipelines most heavily targeted by thieves, and transporting fuel by trucks.
But the logistical changes have slowed fuel deliveries across the country, causing shortages at many service stations and resulting in long lines of cars at stations.
Fuel theft has been a longstanding problem in Mexico that, until recent years, was mostly written off by the government as a business cost, analysts said. But the problem began to worsen about a decade ago as organized crime groups started to diversify their criminal enterprises, including adding fuel theft to their portfolios.
Soaring international fuel prices made the crime particularly attractive. The crime groups co-opted officials at all levels of government using bribery and violence, and won support among impoverished local populations with a steady supply of low-cost black-market fuel and offers of relatively lucrative employment as lookouts and fuel couriers.
Much of the theft occurs through taps drilled under the cover of darkness into pipelines that carry gasoline from the nation’s ports and refineries to distribution centers across the country. Though much of the pipeline system runs underground, thieves operating in remote regions and doing quick work with shovels have been easily able to unearth the pipes. They have generally used high-powered drills to perforate the pipes, installing taps to siphon the fuel.
The problem has soared in recent years. During the first 10 months of last year, the authorities discovered more than 12,500 illegal taps — nearly double the number discovered in all of 2016 and more than 27 times the number a decade ago.
“Oil theft does not only gravely affect our country’s economy,” Gov. Omar Fayad of Hidalgo said in an interview. “Today the state of Hidalgo is crying because of this tragedy, which has taken so many people’s lives. Such regrettable events should never happen again in Mexico.”
Mr. Fayad appealed to the public to help the authorities curb the fuel-theft epidemic, calling on Mexicans “to help us fight this widespread phenomenon and to stay away from pipelines that have been seized or ruptured.”
Mr. López Obrador, who took office on Dec. 1, said about $3.14 billion in fuel had been drained from the system last year and sold on the black market. As part of the crackdown, he has deployed about 4,000 military and police personnel to guard the nation’s fuel infrastructure.