Beijing talked up regional efforts to fight terrorism and boost economic cooperation at a security summit that wrapped up in China on Sunday – hours after the Group of Seven summit in Canada ended in disarray, as the rift deepened between the US and its allies.

The eight members of the Shanghai Cooperation Organisation, led by China and Russia, reached a consensus on strengthening cooperation on anti-terrorism and efforts to reconstruct war-torn Afghanistan during the two-day meeting in coastal Chinese city Qingdao.

Chinese President Xi Jinping called on members of the security grouping to abandon the “cold-war mentality and concept of a zero-sum game”, and to “reject confrontation against the bloc and seeking absolute security for oneself at the cost of others”.

Xi – who was addressing counterparts including Russian President Vladimir Putin, Indian Prime Minister Narendra Modi and Iranian President Hassan Rowhani – also defended the rules of the World Trade Organisation and multilateral system in a world where “unilateralism, trade protectionism and a backlash against globalisation” was taking new forms.

The Chinese president’s unity message was a stark contrast with the divisions evident at the G7 summit of wealthy nations, where US President Donald Trump rejected the joint statement and hit out at host Canada.

Trump left the G7 meeting early to fly to Singapore for talks with North Korean leader Kim Jong-un on Tuesday.

Xi responded that it was “to our regret” that the US had taken the unilateral decision to withdraw from the accord, saying “China is willing to work with Russia and other countries to preserve the Iran nuclear deal”.

Beijing and Moscow have increasingly shown a willingness to set aside their rivalry over influence in the region as they draw closer amid growing pressure from Washington.

In the capital on Friday ahead of the summit, Xi presented Putin with China’s first “friendship medal” at a ceremony broadcast on state television, before the pair watched an ice hockey game, took a high-speed train and ate local Chinese fare.

Putin told reporters on the sidelines of the summit in Qingdao on Sunday that the combined purchasing power of the security bloc outstripped that of the G7, Reuters reported.

On the economic front, Xi offered 30 billion yuan (US$4.7 billion) to the bloc’s banking consortium, emphasising the potential for development through infrastructure projects under China’s vast “Belt and Road Initiative”.

In contrast, US national security adviser John Bolton on Saturday tweeted that Trump had made clear that America would not always be the “bank” of the G7 countries.

Xi also highlighted the anti-terrorism role of the SCO-Afghanistan Contact Group, which restarted meetings between the security bloc and foreign ministry officials in Kabul in October that had been suspended for seven years.

China is concerned that terrorism in Afghanistan has become a serious threat to security at its border and also poses risks to its economic projects in Pakistan.

Indian leader Modi meanwhile told the summit that connectivity projects were welcome but they should be “inclusive and transparent” and “respect the sovereignty and priorities of nations”.

New Delhi has so far refused to join Beijing’s belt and road strategy and voiced its opposition to the US$62 billion China-Pakistan Economic Corridor, which passes through the disputed territory of Kashmir claimed by India and Pakistan.

Modi also said India would play a “positive and constructive” role in promoting peace and reconstruction in Afghanistan.

After a tense border stand-off in the Himalayas last year, relations between Beijing and New Delhi are thawing. On Saturday, in their second bilateral meeting in less than two months, both sides agreed to jointly work on economic programmes in Afghanistan, while China agreed to share data for flood control on the Brahmaputra river that flows from Tibet to Bangladesh.

India and Pakistan were taking part in the summit for the first time as full members, and analysts have said territorial disputes between the two sides could hold back the bloc’s decision-making and slow progress on its economic and security agenda.

Zeng Xianghong, a professor on Central Asian issues at Lanzhou University, said it was “rare and commendable” that the leaders had reached a consensus, especially given the conflict between New Delhi and Islamabad.

“[This follows] calls for years that it is crucial to make concrete progress on specific issues in the organisation,” he said.

The regional security summit also included leaders from Kazakhstan, Kyrgyzstan, Tajikistan and Uzbekistan.