TLAHUELILPAN, Mexico — Mexico’s president vowed on Saturday to redouble his fight against an epidemic of fuel theft after thieves punctured a pipeline north of Mexico City, causing an explosion that killed at least 79 people and injured 81 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 Mexico’s new president, Andrés Manuel López Obrador.The government’s strategy has included diverting fuel from the pipelines most heavily targeted by criminal gangs, and transporting it by truck. But the logistical changes have slowed deliveries across the country, causing shortages and long lines at service stations.Mr. López Obrador, who visited the area early Saturday, insisted that the disaster showed why his strategy was more necessary than ever: Fuel theft not only inflicts financial damage on the nation, but it also exacts a deadly toll.“We have to continue with the plan to end fuel theft,” Mr. López Obrador said during a news conference later at the presidential palace in Mexico City. “We will not stop. We will eradicate this.”On Sunday, Jorge Alcocer, Mexico’s health secretary, said that the death toll had risen to 79, and 81 had been injured, with 66 of them still hospitalized.The fuel theft crisis is an early test of Mr. López Obrador’s efforts to combat the country’s worsening security landscape. He has said he intends to both strengthen the nation’s security apparatus and address underlying social issues, such as inequality and poverty.Last Wednesday, the lower house of Mexico’s Congress approved the creation of a 60,000-member national guard composed of police officers and military personnel to handle the nation’s public security tasks, including its fight against organized crime. The proposal has been widely criticized by opposition parties and human rights activists who say it represents a further militarization of policing. Friday’s explosion, which occurred in a rural, impoverished part of the state of Hidalgo, was particularly deadly because the breach in the pipeline created by criminals had also lured hundreds of villagers from the municipality of Tlahuelilpan, drawn by the promise of free gasoline.That section of pipeline had been among the parts of the fuel transportation network that had been temporarily shut as part of the government’s strategy to curb theft. But the flow through the tube resumed on Friday, just hours before thieves punctured it, officials said.Gov. Omar Fayad of Hidalgo told reporters that his state, like others, had suffered fuel shortages as a result of the government’s strategy.Residents who gathered at the explosion site on Saturday said that while opportunism had prompted some residents to flock to the illegal pipeline tap on Friday, many others were compelled by the shortages created by the government crackdown.Villagers, they said, were desperate to find gas for their personal use.“If there hadn’t been such a bad shortage, this tragedy would not have happened and innocent people would not have died,” said Raúl Linares, 30, a farmer. “People didn’t have a way to move around, get to their jobs, go anywhere.”He added: “We agree with fighting fuel theft, but not this way because it is us who ultimately paid the price.” Mr. Linares said one of his nephews was badly burned in the explosion and another was missing.Videos taken before the blast showed a raucous atmosphere at the site, with villagers from Tlahuelilpan, including families, 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 connects to the nearby Tula refinery operated by the government-run oil firm Petróleos Mexicanos, known as Pemex.Mexico’s defense secretary, Luis Cresencio Sandoval, said that about 25 troops were on the scene, but the contingent was not large enough to turn back the 600 to 800 villagers who had swarmed the site. He said that his troops tried to persuade residents to retreat but their entreaties were ignored, and some of the people turned “aggressive” toward the soldiers.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 and left a blackened scar in the landscape.It was the deadliest pipeline explosion in Mexico in recent memory. In 2010, 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.On Saturday afternoon, forensic investigators and military police officers were examining the scene as scores of residents watched. Some villagers said they hoped to glean information about missing relatives.“We are all mourning today,” said Angela Perez, 54, two of whose neighbors were among the dead. Ms. Perez theorized that many villagers who had flocked to the pipeline rupture wanted to get gasoline to resell.“But it was a foolish mistake,” she said. “Look what happened.”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 portfolios.Rising international fuel prices made the crime increasingly 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 fuel 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 worsened 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.In a news conference on Saturday morning, Octavio Romero, the general director of Pemex, said that in the past three months, thieves had drilled at least 10 holes in the same pipeline that exploded on Friday, also causing fires.“Oil theft does not only gravely affect our country’s economy,” Governor Fayad said in a statement to The New York Times. “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.”He said the death toll could climb even higher.“Many of the gravely wounded are battling between life and death,” Governor Fayad said.The governor also 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.