The U.S.-led invasion of Afghanistan in 2001 was backed by most countries in the region, who shared the goal of ousting the extremist Taliban regime and eliminating the allied Al-Qaeda terrorist network.
The governments in Tehran, Moscow, and Islamabad readily helped the United States fight the extremist groups.
Iran provided crucial intelligence to support U.S. special forces and CIA teams orchestrating the invasion.
Russia supplied Soviet-era maps and intelligence and later allowed the U.S. military to send supplies to Afghanistan through its territory.
Even Pakistan, the chief backer of the Taliban, offered its assistance in helping hunt down Al-Qaeda militants and became the main supply line for NATO forces.
But in the intervening 19 years, the regional consensus favoring the U.S. troops in Afghanistan has eroded.
Though the U.S. military swiftly overthrew the Taliban and eliminated Al-Qaeda safe havens in Afghanistan, many feel it got bogged down in mission creep.
Meanwhile, Washington's ties with many regional players -- including Pakistan, Iran, and Russia -- became toxic.
With U.S. forces scheduled to exit Afghanistan next year as part of a framework peace deal with the Taliban, Washington's rivals see an opportunity to step in and expand their footprint in the war-torn country.
Those efforts have intensified since the United States and the Taliban signed a deal in February aimed at negotiating an end to the war, which began way back in 2001.
Under that agreement, U.S. forces will withdraw from Afghanistan by May 2021 in exchange for counterterrorism guarantees from the Taliban, which has pledged to negotiate a permanent cease-fire and power-sharing deal with the Kabul government.
The delayed intra-Afghan peace talks are expected to be complex and protracted, and will likely take years.
Impatient to end the costly and unpopular war, President Donald Trump is considering fast-tracking the exit of American troops ahead of the U.S. presidential election in November, according to U.S. media reports.
Pakistan Army Chief General Qamar Javed Bajwa: Experts say Islamabad stands to be the biggest beneficiary of a U.S. military pullout from Afghanistan.
Experts say that in the absence of a peace deal, a U.S. military withdrawal could ignite a free-for-all that involves regional powers pursuing often competing interests in Afghanistan.
"The stage has already been set, with many key actors -- including Russia and Iran -- increasing their ties with both the Afghan state and the Taliban," says Michael Kugelman, South Asia senior associate at the Woodrow Wilson International Center for Scholars in Washington.
"The objective is to develop more influence and generate more leverage with key actors across the board, so that they will be in a better position to pursue and achieve their goals in a post-America Afghanistan -- a place we can expect to be increasingly unstable and complex."
Iran, Pakistan, and Russia -- with long histories of meddling in the country -- are hedging their bets. The three countries have sought to improve their relations with the Western-backed government in Kabul, while also reaching out to the Taliban in case it gains a role in a future Afghan government.
Islamabad has retained its long-standing ties with the Taliban and shelters the group's leadership, while Tehran and Moscow have been tacitly working to bolster their ties with the militants, with the goal of expanding their own strategic interests in Afghanistan.
'Make The Taliban Even Stronger'
Pakistan has long been accused of playing a double game in Afghanistan, sheltering and aiding the Taliban while receiving billions in U.S. aid to clamp down on the militants.
Pakistan's ties to the Taliban date back to the 1990s, when it provided arms, training, and intelligence to the militants. Islamabad was one of only three countries to recognize the Taliban government when it took power in Afghanistan in 1996. After the regime's fall in 2001, many Taliban leaders took shelter inside Pakistan.
Observers say Pakistan sees the Taliban as an insurance policy for reaching its long-standing strategic goals in Afghanistan -- installing a pro-Pakistan government in Kabul and limiting the influence of its archrival India, which has close ties to Kabul.
Experts say Pakistan stands to be the biggest beneficiary of a U.S. military pullout from Afghanistan.
"If a withdrawal leads to a peace process that results in a settlement, then Pakistan would benefit as this would likely entail the Taliban holding a fair share of power," says Kugelman. "If the peace process collapses and the U.S. withdrawal ushers in a period of extended destabilization, Pakistan would still benefit because it would make the Taliban even stronger."
Iran has supported its traditional allies in Afghanistan -- the Shi'ite Hazara minority and the Persian-speaking ethnic Tajiks -- while recently establishing contacts with the Taliban, a predominately Pashtun group.
Iran and the Taliban were on the verge of war in 1998 -- when the group controlled most of Afghanistan -- after the deaths of eight Iranian diplomats in the Afghan city of Mazar-e Sharif.
Iran's Supreme Leader Ayatollah Ali Khamenei: The relationship between Shi'ite-majority Iran and the Taliban, a fundamentalist Sunni group, is complex.
Tehran backed the anti-Taliban Northern Alliance before the U.S.-led invasion in 2001. But in recent years the Islamic republic and the Taliban have forged closer ties, with militant leaders even visiting Tehran.
The relationship between Shi'ite-majority Iran and the Taliban, a fundamentalist Sunni group, is complex. Iran officially opposes the Taliban, but experts say it provides some military support to the mainstream Taliban and even rival breakaway factions.
Analysts say that while Iran does not want the Taliban to return to power, Tehran is looking to maintain influence with the group as a hedge in case the Taliban becomes a political player in Afghanistan or it forcibly seizes control of the country.
"These initiatives serve the purpose of securing Iran's sphere of influence in Afghanistan and perhaps even creating a buffer zone on Afghan soil to protect parts of Iran's eastern borders from infiltration by forces hostile to Iran," says Ali Alfoneh, a senior fellow at The Arab Gulf States Institute in Washington.
'A Great Power'
For more than a decade after the U.S.-led invasion, Russian President Vladimir Putin praised Washington for taking on the "burden" of fighting terrorism in Afghanistan and urged it to "carry it to the end."
But since 2014, the Kremlin has attempted to undermine the U.S. mission in Afghanistan, fueled by Moscow's desire to be an international power broker and its rivalry with the West in Ukraine and Syria, where Russia joined Iran in supporting President Bashar al-Assad's regime.
Moscow said it has established contacts with the Taliban in recent years because of the common threat posed by the Islamic State (IS) extremist group in Afghanistan. Washington has accused Russia of arming the Taliban, which it denies.
Russian President Vladimir Putin once praised Washington for taking on the "burden" of fighting terrorism in Afghanistan and urged it to "carry it to the end."
In the past two years, Moscow has hosted two international conferences on the Afghan peace process, inviting Taliban leaders and Afghan opposition members.
Earlier this month, U.S. media reported that a Russian military intelligence unit had offered secret bounties to the Taliban if they killed U.S. or NATO-member troops in Afghanistan.
Moscow and the Taliban have denied the reports, which are based on U.S. intelligence assessments. But the revelations have served to highlight Moscow's murky dealings in Afghanistan.
"Russia's interests in Afghanistan are twofold: to avoid an explosion of chaos on the borders of what it considers its sphere of influence, and to use it as an opportunity to demonstrate and assert its claim to be a great power," says Mark Galeotti, a Russia analyst and a senior associate fellow at the British-based Royal United Services Institute.
Copyright (c) 2018. RFE/RL, Inc. Republished with the permission of Radio Free Europe/Radio Liberty, 1201 Connecticut Ave NW, Ste 400, Washington DC 20036