ISLAMABAD – In announcing his strategy for Afghanistan, U.S. President Donald Trump lashed out at neighboring Pakistan, an ostensible U.S. ally, ordering it to stop giving sanctuary to "agents of chaos, violence and terror."
His predecessors have aired similar complaints, and U.S. officials and analysts have long accused Pakistan of playing a double-game with Islamic extremists -- supporting those that threaten its rivals in India and Afghanistan while cracking down on those who target its own citizens.
Pakistan has been at war with the Pakistani Taliban and homegrown extremists for years, but it has long tolerated the Afghan Taliban and the allied Haqqani network, which are battling U.S. troops in neighboring Afghanistan.
Pakistan has also struggled to combat other forms of extremism. Blasphemy against Islam is punishable by death and has been known to incite mob lynchings. Around 1,000 women are murdered each year in so-called honor killings, and attacks on Shiites and other religious minorities are on the rise.
How did the U.S. come to ally itself with Pakistan, and where do they go from here? The AP explains.
A LONGTIME ALLY
The U.S. backed Pakistan during the Cold War, and in the 1980s the CIA used it as a staging area for efforts to aid the Afghan Mujahedeen, who were then fighting to drive out Soviet troops. At the time, the U.S. viewed the Mujahedeen and Pakistan's president, Gen. Zia-ul Haq — a military dictator who promoted a harsh version of Islam — as allies.
The U.S. renewed the alliance after the Sept. 11, 2001 attacks, as Pakistan again emerged as a key staging ground and supply route in the war to overthrow the Taliban and eliminate al-Qaida. The U.S. has since given Pakistan billions of dollars in military aid.
A DOUBLE GAME
Since the days of Zia and the Mujahideen, Pakistan's security apparatus has supported or turned a blind eye to extremist groups in Afghanistan and the disputed Kashmir region, viewing them as a weapon against India, its main rival.
Pakistan has long feared that Afghanistan would ally with India against it, and sees the Taliban as the best tool for thwarting such an alliance. Pakistan, Saudi Arabia and the United Arab Emirates were the only three countries to recognize the Taliban when they ruled Afghanistan in the 1990s.
That approach became increasingly problematic as the U.S. waged its war on terror. Pakistan's Inter-Services Intelligence agency is widely believed to maintain close ties to the Afghan Taliban and the Haqqani network. Their leaders live relatively freely in Pakistan -- as long as they aren't seen as acting against Islamabad's political interests.
The ISI has long said it has limited influence over such groups, and uses it to pursue regional stability.
BIN LADEN AND A BREAKDOWN
Al-Qaida's top leaders, Osama Bin Laden and Ayman al-Zawahri, also found refuge in Pakistan after the U.S. invaded Afghanistan, but they went into hiding. Whether Pakistan was ever able or willing to track them down remains the subject of heated debate.
U.S.-Pakistan tensions came to a head in 2011 when American commandos killed Bin Laden in a secret raid in Abbottabad, just a few miles away from one of Pakistan's premier military academies. Pakistan once again insisted it had no idea about his whereabouts, and expressed anger over the U.S. carrying out the raid without giving it prior notice.
Shortly after the raid, Pakistan arrested a local doctor accused of running a fake vaccination program in order to gather DNA from Bin Laden, which he then allegedly passed on to the CIA. Pakistan has refused U.S. demands to release the man.
STILL A POWER BROKER
Relations remained chilly in the following years, as the U.S. repeatedly pushed Pakistan to do more to eliminate militant sanctuaries and trimmed military aid when it did not.
But Pakistan remains a major player in Afghanistan, and will need to be on board if Trump hopes to end America's longest war. Pakistan has used its close ties to the Taliban to bring them to the peace table in the past and could do so again, but it will want to preserve its own interests, which appear to be in conflict with the U.S.-backed Afghan government.
Kabul and Islamabad routinely accuse each other of turning a blind eye to Islamic militants operating along their porous border, and relations plunge with every deadly attack.
Senior administration officials said ahead of Trump's speech that he was considering further cuts in aid to Pakistan unless it reins in the Taliban and the Haqqanis, but that approach has failed in the past. Pakistan could respond by revoking U.S. transit rights, shutting off the main supply route to U.S. forces in Afghanistan.
Trump said he hoped to pursue closer ties with India, remarks that were sure to anger Pakistan. But whether that would lead Islamabad to re-evaluate its ties to militant groups — or double down on its support for them — remains to be seen. A tougher U.S. line might also push Pakistan into the arms of Russia, China and neighboring Iran.