Mexico overcame 75 years of nationalist pride to reform its flagging, state-owned oil industry. But as it prepares to develop rich shale fields along the Gulf Coast, and attract foreign investors, another challenge awaits: taming the brutal drug cartels that rule the region and are stealing billions of dollars' worth of oil from pipelines.

Figures released by Petroleos Mexicanos last week show the gangs are becoming more prolific and sophisticated. So far this year, thieves across Mexico have drilled 2,481 illegal taps into state-owned pipelines, up more than one-third from the same period of 2013. Pemex estimates it's lost some 7.5 million barrels worth $1.15 billion.

Pemex director Emilio Lozoya called the trend "worrisome."

More than a fifth of the illegal taps occurred in Tamaulipas, the Gulf state neighboring Texas that is a cornerstone for Mexico's future oil plans. It has Mexico's largest fields of recoverable shale gas, the natural gas extracted by fracturing rock layers, or fracking.

Mexico, overall, is believed to have the world's sixth-largest reserves of shale gas — equivalent to 60 billion barrels of crude oil. That's more than twice the total amount of oil that Mexico has produced by conventional means over the last century.

The energy reform passed in December loosened Mexico's protectionist policies, opening the way for Pemex to seek foreign investors and expertise to help it exploit its shale fields. It hopes to draw $10 billion to $15 billion in private investment each year.

The attractiveness of the venture may hinge on bringing Tamaulipas under control.

"The energy reform won't be viable if we aren't successful ... in solving the problem of crime and impunity," said Sen. David Penchyna, who heads the Senate Energy Commission. "The biggest challenge we Mexicans have, and I say it without shame, is Tamaulipas."

Two rival gangs, the Zetas and the Gulf cartel, long have used Tamaulipas as a route to ferry drugs and migrants to the United States and, in recent years, diversified their business: stealing gas and crude and selling it to refineries in Texas or to gas stations on either side of the border.

At least twice a day, the gangs pull up to one of the hundreds of pipelines that crisscross the state. Workers quickly shovel down a couple of yards (meters) to uncover a pipeline and siphon their booty into a stolen tanker truck, said army Col. Juan Carlos Guzman, whose troops have raided a number of such illegal taps.

A dirt farm road led down to one site outside Ciudad Victoria, 180 miles southwest of McAllen, Texas. About a half-mile from a nearby highway, thieves had dug out a pit and inserted a large needle-like device into the pipeline. By the time soldiers arrived, the gang members had fled, and only the driver of the half-loaded gasoline truck was arrested.

The knowledge needed to tap into the pressurized pipelines leads authorities to suspect the gangs have infiltrated Pemex or co-opted company workers.

"It is impossible to do this without information on the timing and level of flows," said Marco Antonio Bernal, a federal congressman from Tamaulipas who is drafting legislation to toughen punishment for pipeline thefts.

The suspicions were reinforced earlier this month when detectives nabbed a Gulf cartel leader who was found carrying a fake Pemex employee credential, complete with his photo and a false name.

Pemex is installing more automated pipeline shut-off valves operated remotely from a control room in Mexico City. Such controls allow them to not only stop spills often caused by illegal taps but to avoid having to send workers out to unpopulated, dangerous areas to turn off valves manually.

With thousands of miles of pipeline stretching over far-flung regions of Tamaulipas, stopping oil theft is proving hard to do. Mexico has taken steps to rein in the cartels, putting military leaders in charge of the state's security and sending in soldiers, marines and federal police to patrol key cities.

Arrests and violence have taken out so many key Zetas leaders that the cartel's members have taken to camping out in the bush, dragooning Central American migrants into their ranks. They live off the land and change campsites constantly to avoid detection.

"They don't have structures. They sleep under the trees, near rivers to get water," said Gen. Mario Lopez Miguez, who commands nearly 600 soldiers at a base in the once cartel-dominated town of Ciudad Mier.

The Gulf cartel, for its part, remains in control of Tamaulipas' largest city, Reynosa, which sits across from McAllen, although the military has increased its patrols, making some residents feel safer.

"The situation has gotten a lot better," said Nora Gonzalez, who runs a secondhand furniture shop near downtown Reynosa.

Still, just a few blocks away, Reynosa remains dangerous.

A reporter asking residents about the crime situation was quickly approached by a young man driving a battered car with no license plates.

"Where are you from? What are you doing here? Identify yourself," said the young man, using language similar to that of drug cartel lookouts, known as "halcones," or falcons.

"How much money are you carrying? Pull over," the man demanded, as the reporter opted to drive away.