ON A hillside about an hour’s drive north of Nairobi, Kenya’s capital, is a visible demonstration of the difference between the miserable reality of smallholder farming in Africa and what it could be. On one side of the steep terraces stand verdant bushes, their stems heavy with plump coffee beans. A few feet away are sickly ones, their sparse leaves spotted with disease and streaked with yellow because of a lack of fertiliser.

Millicent Wanjiku Kuria, a middle-aged widow, beams under an orange headcloth. Cash from coffee has already allowed her to buy more land and a cutting machine that prepares fodder for a dairy cow that lows softly in its thatched shed. Her bumper crops are largely a result of better farming techniques such as applying the right amount of fertiliser (two bags, not one) and pruning back old stems on her trees. Simple changes such as these can increase output by 50% per tree. Her income has increased by even more than this, because bigger berries from healthy trees sell at twice the price of their scrawnier brethren, says Arthur Nganga of TechnoServe, a non-profit group that is training Mrs Kuria and thousands of other smallholders in Kenya, Ethiopia and South Sudan. This year’s crop will pay for a pickup, she says, so she no longer has to hitch rides on a motorcycle.

Mrs Kuria’s success invites a question. If it is so easy to raise a small farmer’s output, why haven’t all the small farmers managed it? To say that the answer matters is a wild understatement. Africa’s poorest and hungriest people are nearly all farmers. To lift themselves out of poverty, they must either move to a city or learn to farm better.

It should be possible to grow much more in Africa. The continent has about half of the world’s uncultivated arable land and plenty of people to work it. It is true that erratic rainfall adds to the risks of farming on large parts of the savannah, but switching to drought-tolerant varieties of plants or even to entirely different ones—cassava or sorghum instead of maize, for instance—can mitigate much of this problem. Indeed Africa has in the past given glimpses of its vast potential. Five decades ago it was one of the world’s great crop-exporters. Ghana grew most of the world’s cocoa, Nigeria was the biggest exporter of palm oil and peanuts, and Africa grew a quarter of all the coffee people slurped.

Since then it has shifted from being a net exporter of food to an importer. Sub-Saharan Africa’s share of agricultural exports has slipped to a quarter of its previous level; indeed, the entire region has been overtaken by a single country: Thailand (see chart). This is largely because Africa’s crop yields have improved at only half the pace of those elsewhere and are now, on average, a third to a half of those in the rich world. Farmers in Malawi harvest just 1.3 tonnes of maize per hectare compared with 10 tonnes in Iowa.

There are several reasons for the stagnation in African agricultural productivity but poor policies have played a large role. In many countries state-owned monopolies for the main export crops were established either before independence or soon after. The prices paid to farmers were generally squeezed to create profits that were meant to be invested in other, sexier, industries. Such policies failed to spark an industrial revolution but succeeded in making farmers poorer. In Ghana, for instance, the colonial administration and first independent government taxed cocoa exports so heavily that farmers stopped planting new trees. By the 1980s cocoa production had collapsed by two-thirds. In the 1990s many of these policy mistakes were compounded when, urged on by Western donors and aid experts, many African countries dismantled their agricultural monopolies without giving time for markets to develop or putting in place institutions to link farmers to them. This was good for commercial farmers in places such as South Africa, where output soared, but cut off remote smallholders. Farmers in Zambia, for instance, now pay twice as much for fertiliser as those in America. Yet this Cinderella sector is now being seen as an opportunity rather than a “development problem”, says Mamadou Biteye, who heads the African operations of the Rockefeller Foundation, a charity. Money from organisations such as Rockefeller, the Gates Foundation and do-gooding companies such as Nestlé is pouring into supporting small farmers. The first benefit is improved productivity. Farmers have been shown how to increase crop yields sharply simply by changing their techniques or switching to better plant varieties. A second is in improving farmers’ access to markets. Progress here is being speeded along by technology. In Nigeria the government has stopped distributing subsidised fertiliser and seeds through middlemen who generally pocketed the subsidies: it reckons that only 11% of farmers actually got the handouts that were earmarked for them. Instead it now directly issues more than 14m farmers with electronic vouchers via mobile phones.