“Three years of costs were all for nothing,” Mr. Peng said.

His loss was the government’s as well. Because he did not report the episode, local officials could not make sure he followed all the steps necessary to halt the spread, like burying carcasses a considerable distance from the farm. Mr. Peng said he probably buried them too close to his farm but declined to discuss details of the disposal.

The epidemic shows the limits of China’s emphasis on government-driven, top-down solutions to major problems, sometimes at the expense of the practical. It has also laid bare the struggle of a country of 1.4 billion people to feed itself.

China has long viewed food security as tantamount to national security. It had become essentially self-reliant in pork as well as in rice and wheat thanks to subsidies and aggressive farmland management. The swine fever epidemic will test that commitment to its increasingly affluent people, who more often expect meat at the dinner table.

The pig disease — a highly contagious and untreatable outbreak that is not fatal to humans but can be spread by us — has now extended swiftly out of China. It has moved across nine other Asian countries, particularly Vietnam, which is the world’s fifth-largest pork producer and has lost much of its herd this autumn. Before reaching China, the disease had been slowly infecting occasional farms in Russia and elsewhere in Eastern Europe.

Powered by pork, China’s overall food prices last month were one-fifth higher than they were a year ago, after seven years of little change. Large purchases of pork by China are driving up live hog prices in the United States, Europe and around the globe, pushing up costs for everything from German sausages to Vietnamese pork meatballs.