Nearly 20 years ago, the United States invaded Afghanistan with the intent of either killing or capturing Osama bin Laden, the leader of the international terrorist organization, al-Qaeda. Al-Qaeda was responsible for carrying out the September 11, 2001 terrorist attacks against the U.S. In the process of the invasion, American forces overthrew the Taliban, an Afghan group that had come to rule the country in the 1990s.

Now, as the U.S. withdraws from Afghanistan and the Taliban is reasserting control over the country, Afghan civilians and American troops have been targeted by suicide bombers belonging to a third group, known as ISIS-K. The attack at the airport in the capital, Kabul, was one of the deadliest since the war began in 2001; over 170 people were killed, mostly Afghan citizens but also including 13 U.S. soldiers. Because the history and motives of these groups, as well as the cooperation and conflicts between them, can be confusing, here is a brief guide to the groups that have fought against American forces in Afghanistan and continue to battle amongst themselves as the U.S. leaves.

The Taliban grew out of one invasion of Afghanistan and outlasted another

The Taliban is primarily made up of fighters from the Pashtun ethnic group that makes up a large share of the population of both Afghanistan and Pakistan. After the USSR invaded Afghanistan in late 1979, various forces within Afghanistan spent the next decade fighting against the Soviet troops.

Many Afghan Pashtuns also fled to Pakistan as refugees, while Pashtuns also comprised the bulk of the armed Afghan resistance to Soviet occupation. Because these fighters were generally Muslims who were inspired to fight against the atheistic Soviet Union, they were referred to as the mujahideen, a generic word for people who engage in any type of struggle, or jihad, in the name of Islam. They were supported by officials and wealthy individuals from countries such as Pakistan and Saudi Arabia who opposed the Soviet invasion on strategic or religious grounds. 

After the Soviets withdrew and the local communist government collapsed, Afghanistan fell into a period of civil war. A group of Pashtun fighters who had fought the Soviets and studied in extremist religious schools in Pakistan formed, calling themselves the Taliban; as the BBC notes, the name is a Pashto word for “student.” The Taliban defeated rival factions to take control of Afghanistan in the 1990s. They ruled the country based on a very strict interpretation of Islamic law, or sharia. Under their ideology, the rights of women are heavily restricted; activities such as dancing and listening to secular music are forbidden, and violations of religious law are harshly punished.

After being overthrown in 2001, the Taliban has continued to control large portions of Afghan territory in defiance of the American-backed government that ruled from Kabul. It has also operated as an insurgency in Afghanistan, attacking U.S. troops and the American-backed Afghan government that collapsed in recent weeks as American troops left the country.

Al-Qaeda was formed by bin Laden to rally Muslims against the West

During the Afghan-Soviet war, the local Afghan fighters were joined by Muslim fighters from a variety of mostly Arab countries who also came to fight in the name of Islam. These foreign fighters were backed by wealthy patrons, including a young Saudi man, Osama bin Laden, who had inherited part of the fortune from his father’s billion dollar construction company. Around 1988, towards the end of the war, Bin Laden organized a group of the Arab fighters into an organization named al-Qaeda, Arabic for “the Base.” The group moved around, staying in countries like Sudan while its fighters trained.

Bin Laden had come to see the U.S. as an enemy of Islam after American troops set up base in Saudi Arabia – the site of Islam’s holiest cities, Mecca and Medina – during the Iraq War of the 1990s. Al-Qaeda thus began conducting terrorist attacks against the U.S. and its allies. As noted by Dominic Tierney in the Atlantic, the group has focused on attacking Western targets and inspiring Muslim allies to join its cause.

The group eventually resettled in Afghanistan, welcomed by Mullah Mohammed Omar, who was sympathetic to the mission of bin Laden, who, in turn, pledged his loyalty and resources to the Taliban leader. It was from its base in Afghanistan that al-Qaeda planned what would become the September 11, 2001 attacks against the U.S. In the years since the American invasion of Afghanistan, bin Laden and many senior al-Qaeda leaders have been killed, and thousands of al-Qaeda fighters have been killed or captured by the U.S. and its allies. Nonetheless, al-Qaeda continues to operate in a wide variety of countries around the world. 

ISIS broke away from al-Qaeda and tried to create an empire

Al-Qaeda had no real presence in Iraq prior to the 2003 U.S. invasion, despite insinuations from the Bush administration of a connection between the terrorist organization and Iraqi dictator Saddam Hussein. After the invasion, however, Islamic militants joined with ex-members of the Iraqi military to form an Iraqi branch of al-Qaeda to fight against American occupation.

Under the leadership of Jordanian Abu Musab al-Zarqawi, Al-Qaeda in Iraq grew increasingly violent over time, targeting not only Americans but also fellow Muslims who they've deemed to be practicing an incorrect version of Islam or who were not sufficiently religious. The group eventually broke away from al-Qaeda, assumed control of large parts of both Iraq and neighboring Syria, and renamed itself the Islamic State of Iraq and Syria, often abbreviated as ISIS or the Islamic State.

As indicated by its rebranding as “the Islamic State,” the main goal of ISIS has been to establish a caliphate, an empire that rules over all Muslims. Therefore, as expert Aaron Zelin states, “ISIS’s primary goal has been to capture and govern territory.”

At the height of its power, ISIS controlled nearly 40% of Iraq and one-third of Syria, according to the Wilson Center think tank. It has lost control of nearly all of that territory due to the efforts of local, American and other international forces, but ISIS still maintains its goal of creating a caliphate. In doing so, it has recruited various Islamist groups to join its organization or created new branches in various countries.

ISIS has expanded to Afghanistan

In 2015, ISIS created a new branch, ISIS-Khorasan Province, using a historic term for a region that spans much of Pakistan and Afghanistan. ISIS-K, largely made up of former Taliban fighters who have been won over by the Islamic State, seeks to incorporate Afghanistan and Pakistan into the larger caliphate.

ISIS-K does not appear to have the resources to strike targets in the West, as White House Press Secretary Jen Psaki expressed last week. However, ISIS-K has spent several years fighting against both American troops and Taliban forces in Afghanistan; last week's bombing outside the Kabul airport was the latest such attack.

Resistance to the Islamist groups is slowly building

As U.S. forces withdrew from Afghanistan this month, the Afghan military and police collapsed far faster than expected, and the Taliban was able to reassert control over the country in a matter of days. Nonetheless, small pockets of resistance have already emerged against the Taliban and other forces seeking to control Afghanistan.

As profiled in a recent New York Times story, these fighters come from a mix of different sources, including former Afghan soldiers, veterans or children of mujahideen fighters who did not join the Taliban in the 1990s. These fighters, who reject the idea of a radical Islamist state being again imposed on Afghanistan, are appealing for outside aid while also seeking to drum up widespread local resistance to Taliban rule.

Conflict between these groups is likely to continue as U.S. forces leave Afghanistan

Although the Taliban pledged to stop supporting al-Qaeda as part of the deal it struck with the Trump administration for American withdrawal, many sources believe the two groups still cooperate closely. Notably, a number of al-Qaeda fighters were among the thousands of prisoners recently freed from prison by the Taliban as they reasserted control of the country; ISIS fighters were also released. Thursday's attack outside of airport in Kabul was likely an attempt by ISIS-K to both target Americans and their Afghan allies and to embarrass the Taliban by demonstrating that they are unable to provide security in the country.

Internationally, al-Qaeda and ISIS continue to launch attacks against Americans and other Western targets while recruiting or creating new branches in various countries. Competition between the two terrorist networks has often brought them into conflict with one another. For example, the Nigerian militant group Boko Haram, initially founded as a local Islamist militant group, has currently split into multiple hostile factions. Of these factions are a branch affiliated with al-Qaeda, a branch that pledged loyalty to ISIS and one that remained under local control.

In recent years, ISIS and al-Qaeda forces have fought deadly battles in both Syria and Yemen amidst those countries' civil wars. And as the U.S. continues its withdrawal from Afghanistan, a similar multi-sided conflict will likely continue to play out there between ISIS-K, the Taliban, al-Qaeda and any other local or forces that are in the country.