AROUND the world, the food system is in crisis. Prices have rocketed; they are now higher in real terms than at any time since 1984. They could rise further still if drought lays waste to China's wheat harvest, as is feared. Food has played some role (how large is hard to tell) in the uprisings in the Middle East. High prices are adding millions to the number who go to bed hungry each night. This is the second price spike in less than four years. Companies are sounding the alarm and the G20 grouping of the world's largest economies has put “food security” top of its 2011 to-do list.

This attention is welcome. But today's spike is only part of a broader set of worries. As countries focus on food, they need to distinguish between three classes of problem: structural, temporary and irrelevant. Unfortunately, policymakers have so far paid too much attention to the last of these and not enough to the first.

Idle speculation

The main reasons for high prices are temporary: drought in Russia and Argentina; floods in Canada and Pakistan; export bans by countries determined to maintain their own supplies, whatever the cost to others; panic buying by importers spooked into restocking their grain reserves. Influences outside agriculture make matters worse: a weaker dollar makes restocking cheaper in local currencies; and dearer oil pushes up the cost of inputs (it takes vast amounts of energy to make nitrogen fertiliser, so fertiliser prices track oil prices).

Some people mistakenly blame yet another factor: speculation. True, increased financial trading might make prices more volatile, though the evidence is weak. But trading cannot drive prices up in the long term since for every buy, there is a sell. That has not stopped Nicolas Sarkozy, the current head of the G20, from trying to persuade the world's premier economic club to crack down on evil speculators.

At the moment big structural shifts, such as the growth of China and India, are influencing prices less than one might think. The two Asian giants are demanding more food (and more types of food), but so far their own farmers have largely satisfied that, so they have not needed to trade much (though that would change dramatically if China were to import wheat this year).

Over coming decades, though, such fundamental factors will matter more. A good guess is that food production will have to rise by 70% by 2050 to keep pace with population growth, the explosion of developing countries' megacities and the changes in diet that wealth and urbanisation bring. Big increases will be harder to achieve than in the past because there is little unfarmed land to bring into production, no more water and, in some places, little to be gained by heaping on more fertiliser. Climate change may well exacerbate these problems. For the first time since the 1960s the yields of the world's most important crops, wheat and rice, are rising more slowly than the global population (see special report). The world cannot feed today's 7 billion people properly. How on earth can it feed the expected 9 billion in 2050?

The starting point may sound paradoxical: high prices. If 9 billion people are to be fed in 2050, countries that produce a miserable one tonne per hectare will have to produce two; the vast amount of food wasted on poor countries' farms—a third or more of the total—must be saved; and plant breeders will have to reverse the long decline in yield growth. All these things require higher returns to farmers, which will attract higher investment. Without these, there will not just be a billion hungry people (the equivalent of India) but 2 billion extra (two Indias) in 2050. Somehow, returns to farmers must rise without inflicting untold misery on the poor.

Let them eat research

It can be done. Targeting help to the poorest is part of the solution. Conditional cash-transfer programmes, such as Mexico's Oportunidades and Brazil's Bolsa Família (in which the mother gets a small stipend on condition her children attend school and get a health check-up), can work well: 70% of the Bolsa payments go on food.

As for boosting farm output, it will come as no surprise that this newspaper believes that a big part of the answer is removing trade barriers and cutting subsidies. Lowering tariff walls round rich countries would increase poor farmers' exports. An agreement to limit trade bans might make exporters think twice before disrupting world markets. Countries should scrap targets for biofuels which favour an expensive, environmentally damaging business that needlessly distorts food markets. America's ethanol subsidy is a particularly egregious offender. Even opening up retailing to foreigners can help: companies such as Wal-Mart are good at getting food onto supermarket shelves rather than leaving it to rot in the fields.

Although governments can help a lot by getting out of the way in what has been a woefully distorted market, in one respect they need to do more, by reversing the decline in public spending on agricultural research. Unlike other farm subsidies, basic research works. The Green Revolution began with public research. So did Brazil's recent farming successes. Western countries have not learned the lesson. They have complacently cut back on the work done in universities and international institutions. It was a huge mistake. Basic farm research helps the whole world—and is a bargain. One billion dollars would provide many billions of benefits in terms of people fed and food riots forestalled.

Rich countries should therefore properly finance the “CG system”, a network of government-backed institutes, carrying out research into rice, wheat, maize and livestock. And the emerging giants should chip in, too. China, India, Brazil and Russia complain that they do not get the respect they deserve. Here is a chance for them to earn it by helping underwrite a global public good. They should contribute to the CG system (as Mexico, to its credit, is doing) and make their national research available more widely. Few things matter to human happiness more than the yields of staple crops.