FIRST they came for the pension funds. Then they went for the central-bank reserves. Argentines have wondered for years which kitty Cristina Fernández and her government would grab next to sate their appetite for cash. On April 16th they got an answer, when she announced she would send a bill to Congress to nationalise 51% of YPF, the former state oil firm. It will exclusively target the shares that Spain's Repsol bought in 1999, six years after YPF was privatised. “We are the only country in Latin America, and I would say in the world, that doesn't control its natural resources,” she declared.

Energy has long been Ms Fernández's weak spot. When Néstor Kirchner, her late husband and predecessor, took office in 2003, Argentina was a net energy exporter. But as old gasfields have dried up and the economy has grown, the country has suffered an energy crunch. It now uses 15% more hydrocarbons than it produces.

The government has blamed its woes on Repsol, accusing the company of carting off profits instead of reinvesting them. There is some truth to this. Though YPF has invested $11 billion in Argentina since 2006 while handing out $3.5 billion in dividends, it has mostly gone to bolstering existing fields rather than to exploration.

But YPF cites two reasons why it has had to pay money out, rather than spend it on drill-heads. The first is that in 2007 the government concocted a scheme in which Enrique Eskenazi, a bank owner who had previously dealt with Kirchner, would buy a 15% stake in YPF (later raised to 25%). Because he put up precious little cash, the company and a group of banks lent him the money. YPF then agreed to dole out 90% of its subsequent profits in dividends so that he could afford to pay it back.

The other reason goes far beyond YPF, which accounts for just 45% of Argentina's hydrocarbons. As the economy plunged towards collapse in the late 1990s, the government began freezing energy prices. After the currency was sharply devalued, the new government fixed prices in pesos, and increased them later only at a snail's pace. As a result, natural gas is 75-80% cheaper in Argentina than in its neighbours, and electricity is 70% cheaper. The government also began taxing oil exports.

Predictably, the price ceilings led to shortages. Not only did investment dry up, but Argentines also began using far more energy than necessary. At times, the government has resorted to rationing by, say, forcing businesses to turn off their lights early. But it has mainly closed the gap with costly fuel imports. Those purchases—expected to exceed $10 billion this year—have eliminated the trade and fiscal surpluses often called the “anchors” of the Kirchners' economic strategy. That has both weakened the peso and limited Ms Fernández's spending on handouts and infrastructure, which she needs to secure the loyalty of wobbly governors and mayors.

Most governments facing a cash crunch turn to the debt markets. But Argentina has not been able to borrow in the markets for years, because investors demand punishing interest rates and because it is still mired in legal battles with the holdouts from its 2001 sovereign default. As a result, it has had to look for financing internally. In the mid-2000s, Kirchner filled the treasury with taxes on soyabean exports. But when his wife tried to raise them again in 2008, farmers staged a political rebellion and she backed down. Since then, she has turned to temporary fixes to keep cash flowing. In 2008 she nationalised private pension funds. Two years later she began paying debt with central-bank reserves. That was enough to win her re-election. In 2012, however, Argentina's growth has slowed. To cope with the energy industry's effect on the trade balance, the government has restricted imports of countless other products, and made it harder for citizens to swap pesos for dollars. All this has dented Ms Fernández's popularity: her approval rating has fallen from 70% in December to 50% this month. Repsol had hoped that Mr Eskenazi would serve as a shield against government aggression. But since Kirchner died in 2010, Ms Fernández has sidelined the “penguins”, as his associates from his native Patagonia were known, in favour of younger leftist intellectuals in “La Cámpora”, a political group led by her son Máximo. (One of them, Axel Kicillof, will now help run YPF.) Mr Eskenazi thus proved to offer little protection, though Ms Fernández let him keep his shares. Repsol also peddled a stake to China's Sinopec, which had already invested in its Brazilian assets and reportedly made an offer. But it could not consummate a deal in time. Ms Fernández may now try to court the Chinese herself, though they have ample reason to be wary.

Taking over YPF offers Ms Fernández both financial and political benefits. She can divert its $1.3 billion a year in profits, burden its minority shareholders with 49% of the losses from the government's energy imports, stuff it with patronage jobs and choose its suppliers. She may have visions of an oil boom fuelled by YPF's huge recent finds of shale oil and gas. And, like the Falkland Islands, YPF is seen as a symbol of national sovereignty. Argentines will surely rally to the cause, and the bill is expected to pass Congress by a landslide.

The costs of the decision are harder to calculate, because Ms Fernández had paid many of them beforehand. The price of insuring Argentine bonds against default has spiked, but the country was already shut out of debt markets. The shale fields, which require special technology and over $5 billion a year of investment to develop, will lie fallow—as they have since their discovery. YPF's output could fall as it suffers a hostile takeover and skilled employees leave: Daniel Montamat, a former energy secretary, predicts that the expropriation will increase Argentina's 2012 energy trade deficit from some $5.5 billion to $7.5 billion. But that effect is difficult to distinguish from the industry's broader decline.

The biggest immediate risk Argentina faces is reprisals from abroad. Íñigo Méndez de Vigo, Spain's minister for European affairs, warned that Argentina would become an “international pariah”, and the European Commission cancelled a scheduled meeting with Argentine officials. But Ms Fernández is gambling that such threats are empty. Mr Kicillof has scoffed at the $10.5 billion Repsol has demanded in compensation. (A local court will decide what the country will offer.) The firm is expected to take Argentina to arbitration. But such cases take years, and Argentina has a history of leaving awards against it unpaid. WTO rules prevent Spain from imposing unilateral trade sanctions. “If they see there's no retaliation,” says Fernando Navajas of FIEL, a think-tank in Buenos Aires, “this will just be the beginning of the story. There will be a lot more YPFs to come.”