WHEN Egypt, the world's biggest importer of wheat, signalled last year that it would begin enforcing a ban on shipments of the grain with even trace amounts of ergot, a common fungus, it roiled the markets. Egypt, like most countries, had allowed grain with up to 0.05% ergot—a harmless level. The new standard would be nearly impossible to achieve, said suppliers, who proceeded to boycott the state's grain tenders and raise prices. Within months, Egypt had to backtrack.

Yet on August 28th the government reimposed its zero-tolerance policy on ergot, no doubt hoping that doing the same thing again will produce a different result. This is after a UN study found that the fungus posed no risk to Egyptian crops. Instead, the government is relying on its own group of pseudo-scientists, who have disregarded decades of evidence to reach the opposite conclusion. All but one supplier boycotted a state tender on August 31st.

There is perhaps no better example of the Egyptian government's incompetence than its handling of wheat. The state buys millions of tonnes of the stuff each year from local and international suppliers. Subsidies aim to encourage Egyptian farmers to grow more of it. The government then sells loaves to the masses at sub-market prices.

The system is ruinously costly and riddled with corruption. A parliamentary commission's report on the problems runs to over 500 pages and was referred to the prosecutor general on August 29th. Among the findings, officials and domestic suppliers appear to have been falsifying local procurement statistics and pocketing government payments. Investigating MPs say that some 40% of this year's supposedly bumper harvest may be missing, or may never have existed in the first place. Egypt must use scarce dollars to buy wheat from abroad because it does not produce enough at home.

A study by America's agriculture department estimates that Egypt's "unorthodox" agricultural policies will cost the country over $860m in 2016, even as the government considers new austerity measures under a bail-out deal with the IMF. Some of this is simple protectionism. Egypt, for example, bans American poultry parts because they may not be halal. Yet Muslims in Kuwait, Jordan, Iraq and Saudi Arabia happily devour them. Ridiculous standards, unpredictable enforcement and frequent "inspections" by bribe-grabbing officials make life hell for suppliers. The costs are passed on to Egyptian consumers, who are already suffering high food prices.

Despite official pressure to stop the probe into wheat-related corruption, arrests have been ordered, and assets frozen. The biggest head to roll has been that of Khaled Hanafi, the supply minister, who resigned on August 25th. Though not accused of directly profiting from the graft, he oversaw Egypt's food-subsidy programme. Mr Hanafi points to supposed successes, such as instituting smart-cards for bread distribution and reducing costs. But the cards were hacked, and spending on bread subsidies rose on his watch. Somehow his ministry failed to buy rice after the last harvest, leading to nationwide shortages and higher prices.

Oddly, the corruption probe may have encouraged the daft policy on ergot. The supply ministry, which oversees grain purchases, had pushed for reasonable standards. But the government does not want to be seen as doing any favours to traders, some of whom are accused of corruption. The new ban is being billed as an effort to protect Egyptians when, in fact, it will only add to their misery.