“We can no longer be silent about Pakistan’s safe havens for terrorist organizations, the Taliban, and other groups that pose a threat to the region and beyond,” said President Trump in a Monday night speech outlining his new strategy for the war in Afghanistan. With those words, he gave perhaps the strongest public criticism by a U.S. president of Pakistan’s policy in that war, but also echoed a widely held view among U.S. national-security experts. “Pakistan has much to gain from partnering with our effort in Afghanistan. It has much to lose by continuing to harbor terrorists.”

But Pakistan itself has been the victim of several high-profile terrorist attacks in recent years, and its government quickly declared the remarks about safe havens part of a “false narrative,” insisting that “No country in the world has suffered more than Pakistan from the scourge of terrorism. ... It is, therefore disappointing that the US policy statement ignores the enormous sacrifices rendered by the Pakistani nation in this effort.”

The disconnect gets to the heart of why Pakistan has been such a troublesome ally for the United States in its war in Afghanistan, and its efforts against terrorism more broadly. The reasons are geographical, political, and historical. Despite suffering frequent and deadly attacks from local terrorist groups including what’s called the Pakistani Taliban, Pakistan largely views the Afghan Taliban as its ally and fears being buffeted between a pro-Western Afghanistan to its west and a historically hostile India to its east. Perhaps most significantly, while Pakistan’s political leaders might reluctantly go along with Trump’s prescription for Afghanistan, it’s not entirely clear the military, the country’s true power center, will.

Hassan Abbas, a fellow at New America and author of The Taliban Revival, told me Trump’s remarks fit into the context of deteriorating relations between the U.S. and Pakistan. And they may yet have the opposite effect than the one Trump intended. “This … will push them further away from any meaningful cooperation with the U.S. or direct meaningful cooperation with Afghanistan,” Abbas told me.  

Many of the attacks Pakistan itself has suffered were carried out by Sunni groups on Shia, but the deadliest ones have been claimed by the Pakistani Taliban, which shares ethnic and some ideological commonalities with the Afghan Taliban. In recent years, the Pakistani Taliban has been weakened because the Pakistani military launched a major successful offensive against it in the group’s strongholds.

“On a bipartisan basis in the United States, I think nobody doubts that Pakistan has been a victim of terrorism,” Alyssa Ayres, a senior fellow at the Council on Foreign Relations who is an expert on the region, told me. “The problem is that at the same time they are very selective about which terrorist groups they actually try to target.”

Pakistan’s military sees an unfriendly Afghanistan as a major security challenge; Pakistan was, in fact, one of the few countries to recognize the Taliban regime, which was ousted following the U.S.-led invasion in 2001, because it viewed it as friendly to its own interests. The country sees itself largely surrounded by potentially hostile neighbors—Iran in addition to India and Afghanistan—and in recent years has looked to China for military, diplomatic, and economic support. The U.S. sees a very different picture: It has seen an ostensible ally, which is accorded non-NATO ally status, that received tens of millions of dollars in U.S. aid and weapons doing little to nothing to stabilize Afghanistan. Many in the U.S. view Pakistan as the single-biggest destabilizing force in Afghanistan.

Trump’s remarks reflected some of those concerns. Yet Abbas told me it’s unlikely they will have any impact on Pakistan’s policies.

“In my view, Pakistan has earned some of this criticism because their policy on Afghanistan, and their own counterterrorism policy has been flawed, has been defective, has been selective, which has cost many lives in Pakistan also,” Abbas said.  “But if you think strong statements or mere pressure from the U.S., or … taking away the $300 million that is given to the military … will be sufficient to really convince Pakistan to change its calculus, that is like really living in a fool’s paradise.”

Michael Kugelman, the deputy director of the Asia Program at the Wilson Center, put it this way: “Pakistan has deep immutable strategic interests that entail maintaining ties to the Taliban.”

Meanwhile, Kugelman said,the notion of India having a major footprint in Afghanistan is very alarming,” Kugelman said—and it is one that Trump welcomed in his speech. This, argues Kugelman, is one of the reasons Pakistan insists on providing support to the Afghan Taliban and its affiliates in the first place—fearing that India is using Afghanistan as a base from which to meddle in Pakistan, including support for separatist rebels in Balochistan Province, Pakistan supports other groups “that help promote Pakistan’s interest of keeping India at bay in Afghanistan.”

As for India, Trump called on the country to “help us more with Afghanistan, especially in the area of economic assistance and development.” Afghanistan is already a major part of India’s regional policy. The country provided help in the ouster of the Taliban in 2001, and since that time has played an important role in building Afghan institutions and infrastructure: It is already the largest provider of aid to Afghanistan in the region. It has invested tens of billions of dollars in the country, built massive infrastructure projects, is involved in the mining sector, and trains Afghan police, civil servants, and diplomats.

“India has done a lot, and it could do more,” Ayres said. “India could provide advice to shore up Afghanistan’s weak … unity government. India has a lot of experience with political coalitions and dissent and problems. I’m not saying Indian democracy is perfect—no democracy is—but India has got a lot more experience on how to manage these kinds of problems than any other countries in the region do.”

But India’s role in Afghanistan is largely dependent on who is in charge in the country. New Delhi supported the Soviet-backed government of the 1980s and was left out in the cold following the ascent of the Taliban. And although India might welcome Trump’s warmth, it’s also extremely wary of being seen as a tool of U.S. foreign policy. India, despite its tilt toward the Soviet Union during the Cold War and its warm ties with the U.S. now, sees its foreign policy as independent and governed by its own interests. Indian policymakers are aware that the U.S. will at some point leave the region, leaving the countries surrounding Afghanistan, and non-state actors within the country, to fill the vacuum.

Ultimately, that is true for all of Afghanistan’s neighbors: When the time comes for the U.S. to leave, it is they, the Afghan people and government—and the militants—who will fight over Afghanistan’s future.