Starting in late September, China’s top leadership began holding a series of emergency meetings.

An energy crisis had started to engulf the country, propelled by high coal prices. And it wasn’t affecting just factories. Social media showed cars in northeastern China driving on pitch dark roads, people eating dinner by the light of their cellphone and families trapped in elevators that had suddenly shut off.

Fears of a prolonged energy shortage and a winter of discontent were growing.

The scramble by Chinese leaders to address the crisis over the past month coincided with Beijing’s preparations for a United Nations climate summit in Glasgow, highlighting China’s challenge balancing international pressure to speed up its shift away from fossil fuels and the need to keep the supply of energy stable at home.

Major climate declarations Beijing had planned ahead of the summit were delayed as leaders worried about laying out ambitious climate plans to a global audience at the same time that the country tries to ensure there is enough coal to heat households in winter and keep factories going, say people familiar with the discussions.

Eager to appear a major player in the battle against climate change, China often times its climate pledges around international gatherings. President Xi Jinping said at a summit in the spring that China will start reducing its coal consumption after 2025. At last year’s U.N. General Assembly, Mr. Xi changed the date for when China’s carbon emissions will peak from “around” to “before” 2030. Some advanced economies have been asking China to move the date forward even further.

The 16-page document unveiled Sunday mostly reaffirms already announced commitments. But a target for oil consumption to plateau between 2026 and 2030 indicates that China’s carbon emissions are set to peak close to 2025 levels, say analysts.

The document also said more detailed sectoral plans would follow in the coming weeks. On Tuesday, China’s State Council released an action plan with more specific targets for reaching peak emissions before 2030.

China still hasn’t formally submitted its updated emissions-reduction targets to the United Nations, a step it had been expected to make ahead of the Glasgow summit. Alok Sharma, the U.K. climate envoy who is organizing the summit, has said that responses from the world’s biggest economies will be crucial for its success. Those still holding out “must deliver,” he said.

Last week, Mr. Xie, China’s climate envoy, said China wanted to play a constructive role and was working for the success of COP26.

Energy-sector experts say that China’s electricity crunch, its worst in two decades, is mainly the product of a fundamental mishandling of the energy markets by China’s leaders, who largely ignored warning signs of a looming crisis.

While coal prices are set by the market, electricity prices are regulated by the central government. So when faced with skyrocketing global coal prices, power companies were unable to pass along the higher costs to consumers.

The energy-supply crunch came to a head in the final weeks of September. On Sept. 24, a benchmark price for thermal coal reached 1,079 yuan, equivalent to $169, almost double the price from the 580 yuan in early March.

The crisis set off political squabbles. According to people familiar with recent deliberations, various government agencies and state-owned companies have blamed the crisis partly on policies advocated by Premier Li Keqiang to control the price of electricity. The State Council and the National Commission for Development and Reform didn’t respond to requests for comment.

For years, China’s economic planners, led by Mr. Li, have voiced fears of social fallout from allowing electricity prices to rise too fast. In his annual government reports over the past few years, Mr. Li even called for electricity prices to drop 10% annually in both 2018 and 2019, and 5% in 2020 to help keep factories’ production costs in check.

After a series of emergency meetings, including over China’s weeklong national holiday in early October, President Xi ultimately came down on the side of easing price controls, according to two people familiar with the debates. On Oct. 12, China said it would allow the price of coal-fired electricity to fluctuate within a 20% range, up from the 10% range earlier, and to float freely for heavy users.

In the early parts of this year, keeping production costs low, especially for heavy industry, was a priority as China’s growth recovered from the impact of the Covid-19 pandemic.

Early warning signs came in the summer with power shortages in the southern provinces of Yunnan and Guangdong. Energy observers noted that high coal prices made power companies reluctant to fire up their generators for fear of losing money.

Meanwhile, in private settings, state-company executives complained that politically driven actions were crimping coal supply, according to people familiar with those discussions.

At the annual legislative session in the spring, Mr. Xi had asked the Inner Mongolia delegation to step up probes of alleged corruption in the region’s coal sector. The investigations affected more than half of the mines in Inner Mongolia, China’s No. 2 coal-producing region after Shanxi province, according to state media, significantly slowing output as mine managers tried to comply with investigations.

The probes, combined with extensive safety and environment inspections in coal-mining regions and a ban on Australian coal, pushed coal prices to a three-year high in the summer. Australia is China’s largest supplier of imported thermal coal at 5% of the total in 2019.