After 18 years of fighting, the Afghan war is at a deadly stalemate.
Afghanistan is divided among government forces backed by international troops, the Taliban and its militant allies, the Islamic State (IS) extremist group, and a collection of smaller foreign terrorist groups.
The United States and the Taliban signed a landmark agreement in February aimed at "bringing peace to Afghanistan." That deal foresees a power-sharing arrangement between the Afghan government and the Taliban, and the full withdrawal of all foreign troops.
As a Taliban delegation arrived in Kabul for talks on prisoner releases and the Afghan government and the Taliban prepare to launch direct peace talks, most of the country is fiercely contested and ravaged by violence, with warring factions pursuing a "fight-and-talk" strategy.
WATCH: Some 900 Taliban members were freed from Afghanistan's largest prison outside Kabul as part of a prisoner swap under a cease-fire deal on May 26.
Your browser doesn’t support HTML5
The Government
The Afghan government controls the capital, Kabul, provincial capitals, major population centers, and most district centers, according to Resolute Support, the NATO-led mission in Afghanistan.
Around 30 percent of Afghanistan's 407 districts are in government hands, the Taliban commands some 20 percent, and the rest of the country is contested, according to Long War Journal (LWJ), a project run by the Foundation for Defense Of Democracies, a Washington-based think tank.
The LWJ's "living map," based mostly on media reports, is the only publicly available source that tracks district control in Afghanistan, after Resolute Support stopped assessing territorial control and enemy-initiated attacks over the past two years.
Afghan security forces have been on the defensive since NATO's combat mission in Afghanistan ended in 2014, losing much-needed assistance with logistics, air support, and intelligence.
Resolute Support is training, advising, and assisting the 273,000-strong Afghan National Army and Afghan National Police. Additionally, the Afghan government employs around 20,000 militiamen who are part of the Afghan Local Police.
Meanwhile, a separate U.S. counterterrorism force is combating foreign terrorist groups like Al-Qaeda and the IS group and also elements of the Taliban. The United States also funds and supports special Afghan paramilitary units.
The Afghan forces have a large numerical advantage: There are an estimated 60,000 full-time Taliban militants and some 90,000 seasonal fighters.
But government forces are suffering from record casualties, high attrition, and low morale. That is widely blamed on a resurgent Taliban, ineffective leadership in the armed forces, and chronic corruption.
President Ashraf Ghani said in January 2019 that about 45,000 Afghan soldiers and policemen had been killed since he took office in September 2014 -- or a staggering 849 per month. In 2018, the government stopped publicizing fatalities.
"The internationally recognized and elected government doesn't have a monopoly on the use of force nor control over the majority of the country," says Jonathan Schroden, a security expert with the U.S.-based nonprofit research and analysis organization CNA, who has provided assessments on the security situation in Afghanistan to the U.S. military and Congress.
The Taliban, which claims to be a government in exile, "has eroded much of the government's control but cannot do so to the point of becoming the recognized government," Schroden says.
The result, he says, is a "strategic stalemate."
Government forces had been in an active defensive mode since a weeklong reduction-of-violence agreement preceding the U.S.-Taliban deal. But after two devastating terrorist attacks this month that the government blamed on the Taliban, Ghani ordered government forces to go on the offensive.
The political crisis over the disputed presidential election in September also affected the government's military posture. There were fears of civil war after Ghani's leading challenger, Abdullah Abdullah, threatened to form a parallel government and proclaimed himself the president, a scenario that threatened the cohesion of the security forces.
The standoff was resolved after Ghani and Abdullah signed a power-sharing deal -- their second after consecutive elections -- on May 17.
"The government faced serious challenges for months," says Obaid Ali, an expert on the insurgency at the Afghanistan Analysts Network, an independent think tank in Kabul. "The government didn't have a military strategy because the leadership was focused on the internal crisis after the presidential election's outcome and the U.S.-Taliban talks."
Ali says the months-long political feud sank morale and complicated logistics within the security forces.
The Taliban
The Taliban controls more territory than at any time since the U.S.-led invasion in 2001 toppled the fundamentalist group from power.
The fundamentalist militant group's leadership fled to neighboring Pakistan, where it allegedly received sanctuary, training, and arms, an accusation Islamabad has denied. From its safe havens in Pakistan, the Taliban has waged a deadly insurgency against Afghan and international troops.
The Taliban has been following what security experts call an "outside-in" strategy that was effectively employed by other insurgencies in Afghanistan, including the mujahedin who fought Soviet and Afghan government forces in the 1980s.
From its sanctuaries in Pakistan, the Taliban captured rural areas of Afghanistan and consolidated control over larger swaths of the countryside while generating recruits and resources. In recent years, the Taliban has encroached on more populated areas with the aim of isolating and then seizing them.
The militants have twice briefly seized control of the northern city of Kunduz, the country's fifth-most populous.
"The Taliban has so far been successful in seizing and contesting ever larger swaths of rural territory, to the point where they have now almost encircled six to eight of the country's major cities and are able to routinely sever connections via major roads," Schroden says.
"The major thing holding the Taliban back at this point is the government's supremacy of the air and its superior strike forces in the form of the commandos and special police units. But those units are being worn down and the Afghan Army has been slowly failing as an institution for the past five years."
The Taliban insurgency has been a unifying cause for some smaller foreign militant groups.
Around 20 foreign militant groups are active in Afghanistan, including Pakistani extremist groups like the Pakistani Taliban, Lashkar-e Jhangvi, Lashkar-e Taiba, Jaish-e Muhammad, and Central Asian militant groups including the Islamic Movement of Uzbekistan (IMU), the Islamic Jihad Union, and the East Turkestan Islamic Movement, a militant group fighting for Uyghur independence in China.
Ali says the Taliban has ties to some of these foreign militant groups. "Some of these groups operate under the Taliban umbrella," he says. "They can't operate in Afghanistan without the Taliban's permission. Each of these groups has a unique relationship with the Taliban -- operationally, ideologically, or economically."
Al-Qaeda is a largely diminished force, with only several hundred fighters in Afghanistan. But it remains a crucial part of the Taliban insurgency. The two groups have been longtime partners and are co-dependent, according to experts.
According to the U.S. State Department, the "implementation of the U.S.-Taliban agreement will require extensive long-term monitoring to ensure Taliban compliance, as the group's leadership has been reluctant to publicly break with Al-Qaeda."
Under that deal, the Taliban committed to "preventing any group or individual, including Al-Qaeda, from using the soil of Afghanistan to threaten the security of the United States and its allies."
A January report from the UN's Analytical Support and Sanctions Monitoring Team stated that ties between Al-Qaeda and the Taliban "continue to be close and mutually beneficial, with Al-Qaeda supplying resources and training in exchange for protection."
Islamic State
Afghan security forces said on May 11 that they had captured the IS group's regional leader for South Asia, Abu Omar Khorasani, in an operation in Kabul.
This was the latest in a string of recent setbacks for the group.
In April, Afghan security forces in the southern city of Kandahar captured the leader of the IS branch in Afghanistan, Abdullah Orakzai, along with several other militants.
According to the United Nations, since October 2019, over 1,400 IS fighters and affiliates have surrendered to Afghan or U.S. forces.
The U.S. military said the IS group's stronghold in the eastern province of Nangarhar was "dismantled" in November 2019 due to U.S. air strikes, operations by Afghan forces, and fighting between the Taliban and IS militants.
The U.S. military said around 300 IS fighters and 1,000 of their family members surrendered.
The fighters and family members who did not surrender have relocated to Pakistan or the neighboring province of Kunar, a remote, mountainous region along the border with Pakistan, it added.
The U.S. military estimates that there are between 2,000 and 2,500 IS fighters active in Afghanistan.
Ali says that the IS group has bases in a few districts of Kunar Province, and they are also likely present in parts of neighboring Nuristan Province, another remote, mountainous province. But he says recent reports that IS militants were active in northern Afghanistan are "unreliable."
"The group has lost most of the territory it held in eastern Afghanistan," Ali says. "The recent operations against IS have severely weakened them and most have gone underground."
But he says the recent arrests of IS fighters and leaders in major urban areas shows that there are still IS "sleeper cells" in the country.
Most IS fighters are thought to be former members of Pakistani militant groups, especially the Pakistani Taliban.
"There are a smaller number of Afghans, Central Asians, and even fewer from other regional countries," Ali adds.