In one of the more entertaining moments of COP22, the global climate conference held in Marrakech last week, the Chinese vice-foreign minister Liu Zhenmin, gave the absent US president-elect a short lesson in the history of climate diplomacy. Climate change, he explained, was not a Chinese hoax. In fact, long before the issue had been discussed behind the high vermillion walls of Zhongnanhai, China’s contemporary Forbidden City, it had been put on the global agenda by the Intergovernmental Panel on Climate Change in the 1980s, supported by Ronald Reagan and George Bush (senior).

Mounting international concern led eventually to the Kyoto Protocol, the first global agreement to try to limit climate change, signed by President Bill Clinton subsequently rejected by the US Congress. When President Obama’s administration formally entered the successor Paris Agreement in September this year, the president knew better than to try to seek endorsement from a hostile Congress. Yet the US has been present throughout, as the world grappled with how to distribute the burden of global action to ward off climate catastrophe, although its leadership has been, at best, intermittent. It has tended to resemble a temperamental adolescent, periodically playing the game, but intermittently flouncing off the field, its ball firmly under its arm.

This time, rather than seeing the announced US departure from the climate stage under a Trump administration as an excuse for others to slacken their efforts, Chinese officials made clear that this latest act of US self-harm would not deter China from pursuing its own interests, and that those interests lie firmly in a vision of a low-carbon future. As Liu Zhenmin said in Marrakech, any change in US policy “won’t affect China’s commitment to support climate negotiations and also the implementation of the Paris Agreement”.

It is a view that is widely shared in China’s circles of experts and policymakers. While this latest turn in the US administration’s climate policy might be disappointing for the global effort, China’s policy at this point has a standalone logic and an internal coherence that makes a change of direction highly unlikely. China plans to be the supplier of low-carbon goods to a carbon-constrained world: It already boasts the world’s biggest installed capacity of wind and solar power, and its climate policies are built in to its current five-year economic plan.

The departure of the US, far from crippling that effort, could further stimulate it: When the news of Donald Trump’s electoral college victory set cell phones beeping at a private climate change discussion in Beijing, one of China’s leading climate policy experts observed that China should now expect to assume climate leadership.

As recently as 2009, in the wake of the failed Copenhagen climate conference, such a response from China to the election of a man who held Trump’s views would have been unimaginable. At the time, the US and China were locked into a toxic opposition created by the structure of the 1997 Kyoto Protocol, the international agreement that made climate action obligatory for rich countries, but only advisory for emerging economies, even those as large as China. The world’s two biggest emitters of greenhouse gases seemed bound into a negative relationship in which the climate policy of one was conditioned by the willingness of the other to do as much, if not more. Since neither was willing, this dysfunctional pairing acted as dispiriting drag on global efforts.

But between Copenhagen and Paris, China’s global climate policy underwent a sea change, driven by domestic factors and assisted by the end of the Kyoto Protocol. When the Kyoto Protocol was negotiated in 1997, China had 21% of the world’s population, but was responsible for only 14% of global CO2 emissions. By 2009, China was producing 26% of the world’s emissions and had begun publicly to articulate a climate policy. Its first public goal was to reduce its carbon intensity by 40% to 45% by 2020, and as the 2015 Paris conference approached, China, then by far the world’s biggest emitter, announced that its emissions would peak by 2030 or earlier. It is a target most experts judge to be well within China’s reach; some believe that the peak could come in the early 2020s.

The architecture of the Paris Agreement, ratified and brought into force in record time, played a significant role in the breakthrough. It does not impose mandatory action on its signatories; nor does it distinguish between the obligations of the rich and the less rich countries. Each nation, instead, is invited to volunteer its offer on reducing emissions, on the understanding that all will be encouraged to increase their efforts over time, in order to fulfill the common ambition of keeping the global average temperature rise below 2C above pre-industrial levels. This would, in practice, demand that net zero emissions be in effect by mid-century. Meeting that goal will demand much greater efforts than are currently on the table.

The news announced in Marrakech that the world had already experienced1.2 degrees of warming only underlined the urgency of the effort to put the architecture of the Paris Agreement’s implementation in place. Ironically, the US and Mexico were among the first to present long-term carbon reduction plans, with the US offering to reduce emissions by 2050 by 80% from the 2005 level, and Mexico proposing a reduction of 50% by 2050 on a 2000 baseline. By way of comparison, Germany has plans to reduce its emissions by up to 95% by 2050.

How has China, the country that had been seen as the bad boy of climate policy, transformed itself into a potential global climate leader? And why, if Trump is correct in his assertion that efforts to mitigate climate change would cripple the US economy, do China’s leaders see it instead as the key to the next phase of China’s growth?

For China, multiple factors came together between Copenhagen and Paris: China’s growth was slowing and its leaders understood, from the examples of South Korea and Japan, that their economy needed to be more efficient in its use of energy and resources, and that it needed to upgrade its capacity to produce advanced, higher value technologies, preferably with China owning the patents, if it was to avoid stagnation.

By the time the 13th Five Year Plan was published in 2015, it was clear that China’s leadership had identified low-carbon technologies as the technologies of the future, and, since these were new technological frontiers, there was an opportunity for China to establish its dominance as an innovator as well as a manufacturer and exporter. For China, the opportunities that tackling climate offered began to be seen as the engine of the next phase of prosperity. Last year, China invested $102.9bn in renewable energy and installed half of the world’s new wind power. It is still highly dependent on coal, but its coal consumption has peaked and begun to decline, to be replaced over time by renewables, hydro, and nuclear power.

China, like any other country, has vested interests that resist its energy transformation: the giant traditional energy companies defend their interests in China as elsewhere. But the environmental effects of three decades of high-carbon growth — the choking smog that blights China’s major cities, the water crisis and soil pollution, the mounting health and social impacts that threatened the standing of the Communist Party — also created a political space for action.

Xi Jinping’s administration adopted “ecological civilisation” as its slogan and floated a raft of policies that included the restoration of decimated forests, efforts to reverse desertification, the promotion of electric mobility and eco-friendly urbanisation, as well as important investments in new technologies. Given the state of the air that China’s citizens were breathing, there was unlikely to be any popular opposition to a government that wanted to clean up. On top of that, China’s leadership had a clear understanding of the potential impacts of climate change on China, affecting its food security, exacerbating the threat of extreme weather events, ratcheting up its water crisis, and threatening to drown its most prosperous cities as sea levels rise.

China’s role at the Paris conference in December 2015 was constructive. A US-China pledge to cooperate on climate change in 2013 had held firm, despite many other tensions in the US-China relationship. A climate-literate US president and a Chinese leadership that saw the low-carbon economy as its next major opportunity together created a positive synergy that stimulated an extensive program of cooperation, despite the hostility of the US Congress.

Nevertheless, like the rest of the world, China’s leadership will be watching and waiting to see how much of Trump’s extreme rhetoric on climate survives the encounter with reality: He has threatened to “destroy” the Paris agreement and abolish the Environmental Protection Agency, Obama’s key regulatory instrument. A more likely approach is strangulation: The head of Trump’s EPA transition team is a prominent climate denier, Myron Ebell.

The US cannot leave the Paris Agreement quickly: The agreement came into force on 4 November, and it would take nearly four years for the US to withdraw. But the US could simply withdraw from the United Nations Framework on Climate Change, the overarching international climate agreement, within a year.

Trump’s ascension to the presidency signals an end to American leadership on international climate policy. With the withdrawal of US support, efforts to implement the Paris agreement and avoid the most devastating consequences of global warming have suffered a huge blow.

It could also cut off funding, refusing to contribute to funds that are intended to support poor and vulnerable countries to mitigate and adapt.

All of this would weaken the global effort, but it would not destroy it. China is poised to assume the role of steady, reliable climate ally, in sharp contrast to Trump’s US. Assuming leadership on climate has many attractions for China. As well as the economic opportunity, it is one of the few issues on which China could make a claim for the moral high ground.

In terms of industrial strategy, the case seems clear: China still has relatively deep pockets and can finance the dissemination of technologies — from solar panels to nuclear power plants — across the developing world, consolidating trade and diplomatic links at a time when clean energy, according to the International Energy Agency, is projected to grow exponentially, creating millions of jobs and stimulating trillions of dollars in annual investment. That is where China sees its future.