China’s plans to accelerate its world-leading expansion of solar and wind power are facing a major hurdle as floods, droughts and food-supply issues present authorities with a reality check about how much precious farmland the nation can afford to lose.

Solar and wind farms have been supercharged in the past two years since Chinese President Xi Jinping announced a 2060 target for the nation to be carbon neutral, creating an incentive for local governments to allow more large-scale renewable energy projects.

But the pandemic and recent bouts of extreme weather have shown how susceptible the nation is to disruptions in food supply. Good arable land is relatively limited considering the appetite of the nation’s 1.4 billion people, and large tracts of some of the most fertile soil in the heavily populated eastern and central provinces have already been swallowed up by urban growth. With administrations now prioritizing ecological protection and food security, plans to build big, new solar projects are coming under increasing scrutiny.

China is already the world’s largest producer of renewable energy, with the capacity to generate some 679 gigawatts of wind and solar power plus another 390 gigawatts of hydropower. More than a fifth of the solar and wind capacity has been added since 2020 and expansion plans by local governments would carry the nation to its 2030 target of 1,200 gigawatts more than five years early if fully implemented.

But in May, the Ministry of Water Resources issued a rule that bans solar and wind projects on some waterways, lakes and reservoirs as part of measures to protect the ecology and prevent over-development that could disrupt flood control. A separate draft regulation is under consideration by three government agencies, including the Ministry of Natural Resources, that would prohibit new solar projects from cultivated land or forests.

Some local authorities are already clamping down on over-development. In Jiangsu Province a 1 gigawatt floating solar plant that covered 70% of a major lake was partially dismantled this year after local authorities said it was “illegally constructed” and “intervened with flood discharge.”

The shift in priorities has put some provincial governments – especially those in the highly urbanized east – in a bind. While they’ve been tasked with decarbonizing rapidly under China’s national climate pledge, they also face a central government “red line” to protect farmland.

It was considered a “political achievement” to expand renewable energy and that’s why some authorities have been “blindly over-developing solar and wind,” said Qin Yan, an analyst at financial data firm Refinitiv. “But it’s inevitable that some projects violate the rules for ecological protection and cultivated-land protection. The environmental authorities have noticed the problem and are trying to regulate it.”

The shift to prioritizing crops may encourage solar and wind developers to adopt alternative strategies. One is to integrate renewable energy systems into farms in a way that doesn’t curtail food production, such as installing solar panels on top of animal sheds and farm buildings, and placing wind turbines so that they don’t interfere with agricultural operations.

Since last year, China has launched programs such as “Whole-County Rooftop Solar.” The nation aims to cover more than half of newly built public buildings and factories with solar panels by 2025.

Another strategy is to head west, to less heavily populated regions, or mountainous and desert regions with lower agricultural potential, or to use land that’s already been degraded, such as disused coal mines. The country has begun construction of 100 gigawatts of such solar and wind projects, mostly in deserts, and another 450 gigawatts are planned to be built by 2030.

One area garnering attention from solar developers is the Gobi Desert, straddling China’s northern border with Mongolia, where land is cheap and the wind and sunshine are abundant. But it’s thousands of miles from the country’s biggest cities and power-hungry industrial centers, making it expensive to transport the electricity.

To help tap the potential of more remote areas, China is on a spree to build new transmission lines across the country. The nation currently has 33 ultra-high-voltage power lines, and State Grid, which operates 88% of the country’s grid, is investing 380 billion yuan ($56 billion ) to build 38 more between 2021 and 2025.

While those solutions are good in theory, in practice local authorities know they can get much higher revenue from energy generators than from cropland and many violate or bend the rules. Money “flows to the sectors that are most profitable,” said Qin.

Earlier this year, a fight between villagers in Xingtang county in the northern province of Hebei and workers from a solar company made national headlines. The local government had leased farmland for a 200 megawatt  “agricultural solar farm,” and farmers became incensed after the company bulldozed 6.7 hectares (16.6 acres) of wheat that was almost ripe.

Still, the increased concern about arable land means that there’s unlikely to be any utility-scale power plant development in central and eastern regions after this year, so most renewables growth in the next three years will be in the northern and western deserts, according to Peng Peng, general secretary of industry group China New Energy Investment and Finance Alliance.

“Policies that involve land, not only those related to solar projects, are clearly moving in  the direction of prioritizing food production,” Peng wrote in a commentary.