Mexico's state-run oil company, Pemex, is accustomed to being the victim of ill-conceived government meddling, probably because it provides close to 40 percent of the government's revenue.

Pemex also is in decline. Since 2005, daily production has dropped more than 300,000 barrels per day, or roughly 10 percent -- and this at a time of historically high global prices. Reserves have been falling since the mid-1980s. This is relevant to U.S. consumers, because Mexico is the second-largest exporter of oil to the United States, behind Canada.

Mexico, which is not a member of the Organization of Petroleum Exporting Countries, was the world's sixth-largest oil producer in 2006. But many analysts believe that Mexican production has peaked and will decline in coming years, according to the U.S. Energy Information Administration.

Combine declining production with Pemex's out-size contribution to the Mexican government's annual budget, and the need for reform appears urgent. Since the beginning of the year, Mexican politicians have been wrapped up in a debate about how to revive Pemex, which controls all aspects of oil in Mexico, from offshore exploration to the gas pump. It is riddled with wastefulness.

Mexico has to import more than 40 percent of its gasoline because of a lack of refining capacity. It then resells it at subsidized prices to the public. About $20 billion will be spent on the subsidy this year. It is hard to get rid of, because of the direct political impact that ending it would have and because of fear of provoking inflation.

All parties agree that things look bad. There is also some consensus that deep-water exploration of the type that has been so successful in Brazil is now necessary. But there is no agreement about how to fund it, or where to obtain the technical expertise for deep-water drilling. This reveals much about Mexico's underlying thinking about the respective roles of the state and the private sector.

The country's constitution states that the petroleum industry is the exclusive province of the state. The center-right government of Felipe Calderon decided not to attempt to change this, reckoning that the secondary laws that spell out what the constitution means allow enough wiggle room for its plan.

Calderon proposed a package of reforms in April after months of behind-the-scenes negotiation with the Institutional Revolutionary Party (PRI), a centrist opposition party that had been his ally in previous reforms to the state pension system and the public finances. Calderon wants incentive-based contracts for deep-water exploration, to allow private industry to build refineries, and to make a series of changes to Pemex's corporate structure that would give it more autonomy while remaining part of the government.

The opposition dislikes even this limited involvement of the private sector. It can draw on popular antipathy towards the privatization of banks and telecoms, which left assets in the hands of a small number of wealthy people and did not always result in the promised vigorous competition.

Much of the debate has been driven by political posturing, with each party trying to stake out a favorable position for the mid-term elections to be held next year. Calderon had hoped to get a reform passed quickly. This was stymied by the opposition Party of the Democratic Revolution (PRD), which seized the floor of the Chamber of Deputies and forced Calderon and the PRI to subject the reform to several months of expert testimony in the Senate.

This process came to an end on July 22. To keep the brakes on the changes, the opposition is now organizing a series of unofficial referendums on the government's proposal and on privatization. The first one was Sunday in Mexico City and nine states, with two more rounds to follow Aug. 10 and Aug. 24. These votes will have no legal standing but they do have the power to irritate the government.

Jordy Herrera, the undersecretary of planning in the energy ministry, complains that "The only goal of the referendum is to divide Mexicans." Turnout is likely to be low, and those who do vote will almost certainly reject the government's proposals by an overwhelming majority.

Despite the president's high approval ratings, Ricardo Samaniego of ITAM, a university in Mexico City, says Calderon now needs to calculate how much he is willing to dilute his reform. In any case, the plan will not be approved wholesale when Congress reconvenes in September. César Hernandez of CIDAC, a think tank in Mexico City, reckons the president may be ready to compromise. "I believe the government is willing to invest political capital even in a mediocre reform," he says.