FIRST they came for the pensions, then they went for the central-bank reserves. Argentines have wondered for years which kitty Cristina Fernández, the president, would grab next in order to satisfy her government's voracious appetite for cash. On April 16th they got their answer, when she announced that Argentina would expropriate and nationalise 51% of YPF, the former state oil company, which had been sold to Repsol, a Spanish firm, in 1999. Of the confiscated portion, 51% will go to the national government and 49% to Argentina's oil-producing provinces. The president did not reveal how much she plans to pay Repsol in exchange. “We are the only country in America, and basically in the whole world, that doesn't control its own natural resources,” she declared—a puzzling assertion, since foreign companies own resource assets in every oil-producing country in the Americas save Mexico. Argentina is rich in resources. Following a series of big discoveries, its reserves of shale hydrocarbons may turn out to be the world's third-biggest. Nonetheless, in recent years the country has gone from being a net exporter to a net importer of energy, pulling both the fiscal and trade balances into deficit. Hernán Lorenzino, the economy minister, claims Argentina's only goal is “energy self-sufficiency”. The government says it has been forced to import because Repsol has failed to invest in domestic production. In recent months, six provinces confiscated oil concessions from YPF on that basis. But YPF counters that it has invested $11 billion in its Argentine operations over the past five years, and only distributed $3.5 billion in dividends—many of which have gone to pay the loans that Petersen, an Argentine company, took out to buy a share of the company with the support of Néstor Kirchner, Ms Fernández's husband and predecessor as president. Moreover, Repsol says that the real cause of Argentina's declining energy trade balance is its maze of price controls and subsidies, which makes investment unprofitable and encourages excess consumption. Most independent energy analysts agree with this analysis. Taking over YPF offers Ms Fernández both financial and political benefits. She can now use it to conduct the government's money-losing energy imports and have its minority shareholders suffer 49% of the losses. At a time of high oil prices, she could also use the company's profits to finance public spending, since Argentina cannot borrow money because it faces punitively high interest rates and legal threats from holders of its defaulted debt. Politically, after failing to convince the rest of the countries at the Summit of the Americas last weekend to support Argentina's claim to the British-controlled Falkland Islands, the decision provides her a new foreign scapegoat to distract attention from a slowing economy. On the day of the announcement, posters went up around Buenos Aires reading “True sovereignty means taking back what is ours” above the YPF logo.

The medium-term economic costs of the decision could be grim. It eliminates any possibility of securing private investment to develop Argentina's shale fields, which are extremely expensive to exploit. And it will probably lead to an exodus of experts in the oil industry, accelerating the decline in domestic production. But since Ms Fernández and her husband, who died in 2010, had already ruined Argentina's reputation as a safe place to do business long before the nationalisation of YPF, it is not clear how much additional damage the decision will cause. And the economy has remained buoyant for nearly a decade in spite of such policies, because of ever-rising soyabean prices and economic growth in neighbouring Brazil.

The diplomatic costs are another story. The Spanish government has left no doubt that it will do its best to defend Repsol's shareholders. José Manuel García Margallo, the foreign minister, said Friday that “any aggression against Repsol violates the principle of legal security and would be taken as an act of aggression against Spain.” He threatened to cut diplomatic relations if Argentina nationalised the company.

Argentina could presumably mollify Spain by paying a fair price for YPF—which would most likely be half of the $15 billion or so the company was worth before the Argentine government began harassing it. If Ms Fernández winds up offering significantly less, however, she will poison one of her country's oldest and most important bilateral relationships. Repsol would surely file a claim against Argentina at the World Bank's International Centre for the Settlement of Investment Disputes. But such cases take years to resolve, and Argentina has still not paid any of the judgments that have already been handed out against it. That would leave the Spanish government with measures such as trade retaliation—Argentina currently enjoys a trade surplus with Spain—and votes against loans to Argentina by multilateral organisations. If the two sides cannot reach an amicable solution, there may well be fireworks when they meet in June at the G20 summit in Mexico.

(Photo credit: AFP)

(Clarification: Although Spain is not itself a member of the G20, it is represented in the group by the European Union.)