Reaching a global agreement on climate change took more than 20 years of tortuous negotiations. Signed just under a year ago, the insufficient but workable Paris agreement at last constructed a legally binding framework for the principle of cutting carbon emissions. It was to be the foundation of a sustained ratcheting up of ambition that would hold global warming below 2C. Last Tuesday night, as one by one from east coast to west the United States went Republican red, that progress was wiped out.

Donald Trump is the first self-declared climate denier to lead of one of the world’s biggest emitters. Even President George W Bush, though he surrounded himself with sceptics, did not publicly disavow climate science. He even managed a few helpful moves. But Mr Trump has pledged to unpick the Paris agreement. In Marrakech, where delegates are meeting for the first time since Paris, they are putting a brave face on proceedings. But they know the outlook is bleaker than it has been since the collapse of the Copenhagen talks in 2009.

Mr Trump cannot instantly extricate the US from the Paris accord: legal technicalities means withdrawal would take four years, although he may try to speed up the process. That, though, is just legal stuff. His chilling effect on climate negotiations has already begun. That is because these talks rely as much – if not more – on trust, good faith and political will as they do on law and legal process. Remember, for instance, that only the framework of the Paris pact is legally binding, not each country’s commitments on greenhouse gas emissions.

Trust and goodwill can go a long way: the personal charm offensive that President Obama launched on Beijing when he made climate change a legacy issue led to the historic joint statement without which the Paris deal could never have been made. The prospect of its success drew the presence of almost all major world leaders to Paris for the launch of the talks last December, sending an unmistakable signal to their negotiating teams. Now, even if the US remains technically a signatory for a while longer, all this is lost from inauguration day in January.

With a hostile US, China may cool on its commitments, or at least take a tougher stance, as it has done before. India was already a reluctant participant and the change in the US position is likely only to make its grumbles louder.

Games of “what if” are irresistible at this stage. As delegates started to gather in Marrakech, the world appeared on the brink of an unprecedented phase of stability. The Paris agreement had come into force within a year of its agreement, an astonishing achievement after the discord and mistrust that had threatened all the preceding meetings and even the whole UN climate process. But now that huge achievement may be shattered. Diplomats are working furiously to reassure countries that the departure of the US would not mean the end of the road and the process can continue.

And it is not only the global talks. In the US, too, more climate-unfriendly actions from a Republican-dominated Congress, like changes to clean energy subsidies, are on the cards, while President Obama’s clean power plan to regulate power stations is under grave threat. Mr Trump’s proposed leader of the Environmental Protection Agency is a prominent climate sceptic, Myron Ebell, a man once described by a senior George W Bush aide as “crazy Myron”.

Finally, a right-leaning supreme court may put a brake on future legal challenges from environmental groups. Taken with Mr Trump’s support for coal, US emissions may soon be back firmly on their upward track. And if he really wants to “cancel” Paris, Trump could even pull the US out of the UN framework convention on climate change, the foundation treaty under which Paris was signed. If he did, the world would lose its global forum for taking fair and effective action on greenhouse gases and adapting to climate change.

Withdrawal may be a step too far even for Trump, for the treaty gives the US a seat at the table that pragmatists would rather retain, even if they try to saw the legs off.

For delegates in Marrakech, the only source of optimism may be their years of experience in holding the talks together. But they cannot do it on their own. In the end, it may all come down to scientifically literate Republicans in Congress. They must be the voice of the two-thirds of Americans who understand the link between human activity and global warming – and want to break it.