HANGZHOU, China - The United States and China on Saturday formally joined the Paris climate deal, with President Barack Obama hailing the accord as the “moment we finally decided to save our planet”.

The move by the world’s two biggest polluters is a major step forward for the 180-nation accord, which sets ambitious goals for capping global warming and funnelling trillions of dollars to poor countries facing climate catastrophe. Obama and his Chinese counterpart Xi Jinping handed ratification documents to UN chief Ban Ki-moon, who said he was now optimistic the agreement will be in force by the end of this year.

At the ceremony in the Chinese city of Hangzhou, Obama said climate change would “define the contours of this century more dramatically than any other challenge”. History would show that the Paris deal would “ultimately prove to be a turning point”, he said, “the moment we finally decided to save our planet”. “There’s an American saying, You need to put your money where your mouth is. That’s what we’re doing.”

The Paris agreement aims to limit global temperature increases to two degrees centigrade, and will be triggered after at least 55 countries, accounting for 55 percent of global greenhouse gas emissions, ratify it.

China is responsible for almost a quarter of the world’s emissions, with the US in second place on around 15 percent, so their participation is crucial.

China’s Communist-controlled parliament ratified the agreement earlier Saturday, and President Xi said the Asian giant was “solemnly” committed to the issue. “Hopefully this will encourage other countries to take similar efforts,” he said in Hangzhou, where he is to host the G20 summit of the world’s leading developed and emerging economies.

Until Saturday only 24 of the signatories had ratified the accord, including France and many island states threatened by rising sea levels but who only produce a tiny proportion of the world’s emissions.

Ban said there would be a “high level” meeting in New York later this month to push more countries do so, and told the two leaders that they had “added powerful momentum” to efforts to bring the accord into force. “I am optimistic we can do it before the end of this year.” Climate is one of the few areas where the world’s two most powerful countries - who are at loggerheads on issues ranging from trade disputes, cyberspying and the South China Sea - are able to find common cause.

Campaigners welcomed the move, with WWF saying the two giants economies had sent “a very powerful signal that there will be real global action on climate change”. But some environmental groups say that the Paris pledges by China, the US and other fall far short of what is needed to meet the goal of less than two degrees of warming. “This moment should be seen as a starting point, not the finale, of global action on climate,” said Greenpeace policy adviser Li Shuo.

The Paris pact calls for capping global warming at well below two degrees Celsius (3.6 degrees Fahrenheit), and 1.5 C (2.7 F) if possible, compared with pre-industrial levels.

For China, ratifying the agreement fits with Beijing’s domestic political agenda of being seen to make efforts to clean up the environment, after years of breakneck industrial development led to soaring air, water and ground pollution.

The scourge is estimated to have caused hundreds of thousands of early deaths, and is the source of mounting public anger.

Under the Paris accord, China has pledged to cut its carbon emissions per unit of GDP by 60-65 percent from 2005 levels by 2030 and increase non-fossil fuel sources in primary energy consumption to about 20 percent.

Neither of those requirements implies a commitment to cut absolute levels of emissions, although China is also obliged to have them peak by “around 2030”. In its Paris commitment, the US promised to cut its own emissions 26-28 percent below 2005 levels by 2025.

During the negotiations over the Paris deal Beijing stressed the concept of “differentiated responsibilities” - the idea that developed countries should shoulder the lion’s share of the burden as they have polluted most since the Industrial Revolution.

For its part the White House is looking for the Paris accord to come into force during Obama’s tenure, in part to burnish his climate legacy, but also to ensure the forthcoming US election does not obstruct US participation.

The administration is arguing that the deal does not need Congressional approval for ratification, which can be done by executive order.

Policymakers from Tokyo to Stockholm have bitter memories of George W. Bush and his Republican Party refusing to ratify the Kyoto Protocol after it was agreed by Bill Clinton’s administration.

Meanwhile, when US President Barack Obama arrived in China Saturday for his final trip to Asia as commander in chief, the ceremonial niceties were marred by an undiplomatic shouting incident on the tarmac.

Chinese authorities have imposed extremely tight security precautions for the G20 summit, and not even US National Security Adviser Susan Rice and the White House press corps proved exempt when Air Force One landed in host city Hangzhou.

As usual when Obama travels, the reporters accompanying him were brought under the wing of the Boeing 747 to watch him come down the aircraft stairs, penned off behind a blue rope installed by Chinese security.

But that was not far away enough for the Chinese personnel, one of whom screamed at White House staff, demanding the US press leave the scene.

A female White House official, handbag over her arm, told him that it was an American plane and the US president.

“This is our country!” the Chinese official, in a dark suit, shouted at her in English. “This is our airport!”

When US National Security Adviser Susan Rice and senior White House staffer Ben Rhodes tried to get closer to the president, lifting up the blue rope and walking under it, the official turned his ire on Rice, trying to block her progress.

As they exchanged angry words her Secret Service agent stepped in to usher her past him.

Moments afterwards the US president’s motorcade was rolling away, towards a city of nine million people that has been denuded of around a quarter of its population for the event.

Factories have been closed to ensure blue skies, potential troublemakers detained, and the wide boulevards of a city lauded by Venetian traveller Marco Polo are empty.

“They did things that weren’t anticipated,” Rice told reporters later.