Pakistan, already furious and reeling from US President Donald J. Trump’s threat to sanction it for supporting militants, has been dealt a potential body blow out of left field. Five major emerging powers, including China and Russia, have for the first time identified Pakistan-backed militant groups as a regional security threat in a statement at the end of a summit in Xiamen.

The statement by the BRICS countries, which also include India, Brazil and South Africa, called into question the degree to which Pakistan will be able to resist US pressure by aligning itself closer with China and Russia. It also strengthened India’s position that had already been boosted by Mr. Trump urging Delhi to step up its engagement in Afghanistan.

The statement could trap Pakistan in a pincer movement in which the very fundament of its national security policy would be challenged. Pakistan has long seen various militant groups, many of which have been designated as terrorists by the United Nations and/or the United States, as useful proxies in its zero-sum-game-approach towards India.

Pakistan has also supported the Taliban in part to counter India, which it says uses Afghanistan as a launching pad for covert operations inside Pakistan. A former senior Indian military commander recently acknowledged that Afghanistan was important to India because its security services had over the years moved away from gathering human intelligence in Pakistan.

Defense Minister Khurram Dastagir Khan rejected the statement within hours of its publication. “We reject this thing categorically, no terrorist organization has any complete safe havens,” Mr. Khan told a Pakistani tv station.

In an Afghanistan-focused speech on US policy in South Asia, Mr. Trump last month insisted that Pakistan’s partnership with the United States would not survive if it continued to harbour and support groups that target the United States.

In response, Pakistan asked US Assistant Secretary of State Alice Wells to indefinitely postpone a planned visit to Pakistan. Similarly, Pakistani foreign minister Khawaja Muhammad Asif cancelled a visit to Washington and said he would be visiting China, Russia and Turkey instead.

The BRICS statement threatens however to pull the rug from under what Mr. Asif hoped to achieve on his travels. The statement was in stark contrast to China and Russia’s response to Mr. Trump’s threat. Chinese Foreign Ministry spokeswoman Hua Chunying at the time insisted that Pakistan was on the front line in the struggle against terrorism and had made “great sacrifices” and “important contributions” in the fight. Russia responded similarly to Mr. Trump.

The BRICS statement, however, sang a very different tone even if it did not identify Pakistan by name. It noted that Chinese President Xi Jingping, Indian Prime Minister Narendra Modi, Russian President Vladimir Putin, Brazilian President Michel Temer and South African President Jacob Zuma “express concern on the security situation in the region and violence caused by the Taliban, ISIL/DAISH, Al-Qaida and its affiliates including Eastern Turkistan Islamic Movement, Islamic Movement of Uzbekistan, the Haqqani network, Lashkar-e-Taiba, Jaish-e-Mohammad, TTP and Hizb ut-Tahrir.”

Pakistan stands accused of supporting several of these groups, including the Taliban, the Haqqani network and Lashkar-e-Taiba (LeT). Pakistan put Muhammed Hafez Saeed, one of the world’s most wanted men and the UN and US-designated leader of Jama’at-ud-Dawa (JuD), widely viewed as a LeT front, under house arrest earlier this year. LeT itself has been designated by both the UN and Pakistan. JuD recently announced that it was forming a political party that would compete in elections.

Mr. Saeed is believed to be among others responsible for the 2008 attacks on 12 targets in Mumbai, including the Taj Mahal Hotel, a train station, a café and a Jewish centre. Some 164 people were killed and more than 300 wounded. The US government has a bounty of $10 million on Mr. Saeed who was once a LeT leader. He has since disassociated himself from the group and denied any link between JuD and LeT.

Jaish-e-Mohammed (JeM), a group proscribed by both the UN and Pakistan, poses a more difficult challenge and its naming in the BRICS statement puts not only Pakistan but also China on the spot. China, at the behest of Pakistan, twice this year prevented the United Nations from listing the group’s leader, Masood Azhar, as a globally designated terrorist.

Mr. Azhar, a fighter in the anti-Soviet jihad in Afghanistan and an Islamic scholar who graduated from a Deobandi madrassah, Darul Uloom Islamia Binori Town in Karachi, the alma mater of numerous Pakistani militants, is believed to have been responsible for an attack last year on India’s Pathankot Air Force Station. The militants, dressed in Indian military uniforms fought a 14-hour battle against Indian security forces that only ended when the last attacker was killed.

Mr. Azhar, a portly bespectacled son of a Bahawalpur religious studies teacher and author of a four-volume treatise on jihad as well as books with titles like Forty Diseases of the Jews, was briefly detained after the attack and has since gone underground.

Freed from Indian prison in 1999 in exchange for the release of passengers of a hijacked Indian Airlines flight, Mr. Azhar is also believed to be responsible for an attack in 2001 on the Indian parliament in New Delhi that brought Pakistan and India to the brink of war. JeM despite being banned continues to publicly raise funds and recruit fighters in Pakistani mosques.

“You cannot have good and bad terrorists, and it is a collective action. Members of the BRICS countries have themselves been victims of terrorism, and I would say that what has come of today acknowledges the fact that we must work collectively in handling this,” Indian foreign ministry spokeswoman Preeti Saran told reporters immediately after BRICS issued its statement.

The Xiamen statement is certain to have caught Pakistan off balance. Mr. Asif is likely to find out what the statement means when he visits Beijing and Moscow. Ultimately, the proof will be in the pudding when the UN Security Council in early 2018 again looks at designating Mr. Azhar and China will have to take a stand.

Already, China’s more than $50 billion investment in Pakistani infrastructure and energy has been threatened by attacks by militant groups that are the target of Pakistani crackdowns. The BRICS statement suggests that Chinese patience with Pakistan’s selective support of militancy may be wearing thin.

That could be good news for Mr. Trump. To turn it to his advantage, Mr. Trump would have to find common ground with China and Russia in forging a negotiated exit from America’s Afghan quagmire. Sixteen years into the war, Mr. Trump is increasing the US military presence in Afghanistan. The silver lining is that he hopes that will force the Taliban to come to the negotiating table.