PETROLEOS MEXICANOS, Mexico’s monolithic, government-backed petroleum company, is one of the largest oil producers in the world. It’s also in deep trouble.

The firm, known as Pemex, is a listless, legally mandated monopoly propped up on foggy-brained justifications about national pride and sovereignty. Pemex’s bureaucracy is impenetrable, the leader of its union lives extravagantly and, in a recent poll, about 80 percent of Mexicans associated the firm with corruption. The state, meanwhile, skims massive amounts of money off the top to fund a third of the national budget, and the company hasn’t managed to use what’s left over to break into deep-water oil extraction or to ramp up oil and natural gas production from onshore shale rock. Though the firm still produces a lot of crude, it is $60 billion in debt.

It all worked well enough when the company had abundant supplies of easy-to-extract oil in shallow waters in the Gulf of Mexico. But that’s drying up, and reality has finally breached the Pemex bubble. Its production has fallen by a quarter in the past decade. Mexico may suffer the humiliation of becoming a net fossil-fuel importer. Even though Pemex has been politically untouchable for decades, all of the country’s major parties now want reform of some kind. President Enrique Peña Nieto proposed his own slate of changes last week; altering the constitution to lift some of its restrictions on Mexican oil production seems politically doable. That’s the good news.

The best option for Mexico’s leaders is to open up the oil business, reduce the state’s dependence on petroleum revenue and privatize Pemex, forcing the company to compete against nimbler foreign companies subject to consistent rules and reasonable taxation. Productivity would shoot up, as would economic growth. That sort of ambitious restructuring, however, seems far beyond reformers’ imaginations. Instead, Mexico’s leaders appear focused on inviting private investment into the country's oil sector. Foreign companies might bring know-how and, critically, cash to Pemex projects in deep water or in shale-rock formations. In return, they might get a cut of the profits. Pemex, meanwhile, would try to make itself more efficient and technologically adept, as the government figures out how to let the company keep more of its revenue for further investment.

Already, industry analysts wonder whether Mexico will be able to pull off even that. Big oil companies, when they enter into contracts with various governments, typically require slices of the production that results — barrels they can put on their balance sheets. National control over oil resources is so sacrosanct in Mexico that it’s not clear the government will allow that to happen. But without the accountability that would come with shareholders or private ownership, the firm will continue to suffer from lack of exposure to the signals that encourage smart cost-cutting and investment decisions.

Still, some reform is better than none, particularly if it leads to better decisions about how and where to invest money in Mexico’s energy sector. As the country’s leaders figure out the crucial details, they should go as far as they can to loosen the government’s choking grip.