China’s leader has made it a national priority to ensure the country can feed its large population. But weather shocks have disrupted wheat harvests and threatened pig and fish farming.The downpour began in late May, drenching the wheat crops in central China. As kernels of wheat blackened in the rain, becoming unfit for human consumption, the government mobilized emergency teams to salvage as much of the harvest as possible. In a viral video, a 79-year-old farmer in Henan Province wiped away tears as he surveyed the damage.The unusually heavy rainfall, which local officials said was the worst disruption to the wheat harvest in a decade, underscored the risks that climate shocks pose to President Xi Jinping’s push for China to become more self-reliant in its food supply.Ensuring China’s ability to feed 1.4 billion people is a key piece of Mr. Xi’s goal of leading the country to superpower status. In recent years, tensions with the United States, the coronavirus pandemic and Russia’s war on Ukraine have all created more volatility in global food prices, heightening the urgency for China to grow more of its own crops.The country has not experienced food price inflation at the levels seen in other major economies, but officials are concerned about the vulnerability of its food supply to global shocks. Last summer, prices for pork, fruit and vegetables spiked in China, prompting the government to release pork from its strategic reserves to stabilize prices. Afterward, Chinese leaders reiterated their call to prioritize food security.In recent weeks, extreme heat has killed fish in rice paddies in southern China’s Guangxi Province and thousands of pigs at a farm in the eastern city of Nantong, according to local news reports. The fire department in the northeastern city of Tianjin was called in to spray water on pigs that were suffering heat strokes while riding in a truck. Officials have warned about extreme heat and flooding damaging wheat crops in the northwestern region of Xinjiang.In a country where famines have destabilized dynasties throughout history, the ruling Communist Party is also aware that fulfilling basic needs is a prerequisite for political stability.Harvesting wheat in early June in Zhumadian, Henan Province, China.Josh Arslan/ReutersLast year, food shortages became a potent source of unrest after the government imposed a draconian lockdown on Shanghai, a city of 25 million people, to control the spread of the coronavirus. Online videos showed fighting among residents in the streets and in grocery stores to grab food. In the nationwide protests that ensued against China’s “zero Covid” policies, protesters shouted, “We want food, not Covid tests.” Already, farmland in China is shrinking, as rapid urbanization has polluted large swaths of the country’s soil and governments have sold rural land to developers. The distribution of water between northern and southern China is uneven, leaving some crop-growing regions vulnerable to droughts and others to flooding. The war in Ukraine has threatened China’s access to wheat and fertilizers. And a trade war with the United States that began in 2018 made it more expensive for China to buy soybeans and other foods from America.Mr. Xi has depicted self-reliance in food as a matter of national security, often saying, “Chinese people should hold their rice bowls firmly in their own hands.” He has set a “red line” that the country must maintain 120 million hectares of farmland, and has declared war on food waste, especially in restaurants. The Chinese government frequently points out that it has to feed one-fifth of the world’s population with less than 10 percent of the world’s arable land.Farmers spreading fertilizer in a recently harvested wheat field, now newly planted with corn, in Luohe, Henan Province, this month.Qilai Shen for The New York TimesTo create a more stable food supply, China has stockpiled crops and purchased more farmland overseas. It has been developing heat-resistant rice strains, genetically modified soybeans and new seed technologies, an effort that has triggered accusations of intellectual property theft from the United States.An article on the front page of the People’s Daily newspaper on Monday said Mr. Xi had a “special affection” for farmers and prioritized increasing their incomes. Last month, he visited a wheat field in northern China’s Hebei Province, where farmers were attempting to boost grain production by growing wheat varieties that could withstand drought.In a state-produced video of Mr. Xi’s visit, local officials showed off the breads and noodles that could be made with the new wheat varieties. “President Xi hopes that we can lead a happier life,” a local farmer said in the video, “and we will work harder toward that goal.”But weather-related shocks to the food supply are a far more unpredictable challenge.“You can impose more regulations to dis-incentivize local governments from selling farmland. You can subsidize farmers,” said Zongyuan Zoe Liu, a fellow for international political economy at the Council on Foreign Relations, a U.S.-based research institute. “But when extreme weather conditions happen, it not only creates damage, but it’s also very expensive to fix.”This month, record rainfall flooded the city of Beihai in southern China. And parts of China, including major cities like Shanghai and Beijing, have already experienced unusually early heat waves this year, with temperatures this month exceeding 106 degrees Fahrenheit in some areas.But the most recent fears about food security stemmed from the flooding in Henan Province and the surrounding regions in central China, which produce more than three-quarters of the country’s wheat.A farmer planting soy beans in a recently harvested wheat field in Luohe on Wednesday.Qilai Shen for The New York Times“During harvest season, the thing wheat farmers fear the most is long-lasting rains,” said Zhang Hongzhou, a research fellow who studies China’s food strategy at Nanyang Technological University in Singapore. “This is happening at the worst time.”The rains hit just as farmers were preparing to begin this year’s harvest, causing some of the wheat to sprout. This lower-quality wheat is unsuitable to process into flour and is typically sold at a lower price as animal feed.The extent of the damage to this year’s crop is still unclear. A lower wheat yield could force China to import more wheat this year and raise global grain prices, analysts said.China is the world’s largest producer and consumer of wheat. Demand has risen along with incomes as people in cities buy more Western-style breads and desserts. Soaring meat consumption in China has also necessitated more wheat, which is used for animal feed.In response to the rainfall in Henan, the Chinese government authorized 200 million yuan, or about $28 million, in disaster relief to help dry the wet grains and drain the soaked fields. Rural officials set up a 24-hour hotline for farmers and urged local governments to find corporate buyers for damaged wheat that is still edible.A farmer watering a recently harvested wheat field in Luohe.Qilai Shen for The New York TimesState media outlets have said the government’s efforts minimized losses for farmers, with a front-page article in a recent People’s Daily newspaper trumpeting the progress of the harvest. CCTV, the state broadcaster, aired a 15-minute video segment showing government officials warning farmers to harvest early.China’s fixation on food security has global implications, in large part because it maintains huge stockpiles of food, including what the U.S. Department of Agriculture estimates is about half of the world’s wheat reserves. Last year, U.S. officials accused China of hoarding food stocks and causing global food prices to rise, particularly in poorer countries. In response, China blamed the United States for instigating a global food crisis, saying American sanctions against Russia were hurting wheat exports to African countries.Gauging the stability of China’s food supply is difficult because information about the exact quantity and quality of its crop stockpiles is treated like a state secret. Although the country’s official data regularly shows record high wheat output, for instance, analysts have questioned the reliability of the data.But in January 2022, the government offered a rare glimpse. In response to the accusations by Western countries that China was hoarding food, a commentary published in The Economic Daily, a state-controlled newspaper, revealed that China had enough wheat and rice reserves to feed its people for at least 18 months, which the article suggested was a reasonable amount of stockpiling.“To be prepared for unexpected incidents is a principle of governing a nation,” the commentary said.Farmers planting soy beans in Luohe. A trade war with the United States that began in 2018 has made it more expensive for China to buy soybeans and other foods from America.Qilai Shen for The New York TimesZixu Wang More