Political parties have usually been illegal in Afghanistan, forcing most political activity—influenced by ideological, linguistic, and ethnic considerations—to operate underground or from abroad (or both). The 1964 constitution provided for the formation of political parties. However, since the framers of the constitution decided that political parties should be permitted only after the first elections, and since the Parliament never adopted a law governing the parties' operation, all candidates for the parliamentary elections of August and September 1965 stood as independents. Because a law on political parties was not on the books four years later, the 1969 elections were also contested on a non-party basis. Throughout the 1964–1973 period, however, the de facto existence of parties was widely recognized. Subsequently, the framers reversed their plan to allow political parties. Under the 1977 constitution, only the National Revolutionary Party (NRP), the ruler's chosen instrument, was allowed.
The 1978 coup was engineered by the illegal People's Democratic Party of Afghanistan (PDPA) which had been founded in 1965. During its brief history, this Marxist party had been riven by a bloody struggle between its pro-Soviet Parcham (flag) faction and its larger Khalq (masses) faction. Babrak Karmal was the leader of the Parcham group, while the Khalq faction was headed until 1979 by Nur Muhammad Taraki and Hafizullah Amin. The factional struggle continued after the 1978 coup, prompting the Soviet intervention of 1979. Factional bloodletting continued thereafter also, with repeated purges and assassinations of Khalq adherents as well as bitter infighting within Parcham, this last leading to Babrak Karmal's replacement as PDPA secretary-general in May 1986 by Najibullah.
The Islamic resistance forces opposing the PDPA government and its Soviet backers in Afghanistan represented conservative, ethnically-based Islamic groups which themselves have had a long history of partisan infighting (and repression by successive Kabul governments). They came together in the early 1980s to fight the common enemy, the communist PDPA and the Soviet invaders and, in 1985, under pressure from Pakistan and the United States, they were loosely united into a Seven Party Alliance (SPA), headquartered in Peshawar, Pakistan. By 1987, commando groups affiliated with one or more of these seven parties controlled more than 80% of the land area of Afghanistan.
With arms flowing in from outside the country—a flow not halted until the end of 1991—the fighting continued, but with the final withdrawal of Soviet troops in February 1989, the SPA stepped up its military and political pressure on the communist PDPA government. However, President Najibullah proved to have more staying power than previously estimated, using Soviet arms supplies, which continued until the end of 1991 to buttress his position, while playing upon divisions among the resistance, embracing nationalism and renouncing communism, and even changing the name of the PDPA to the Wattan (Homeland) Party. It was only in April 1992, with the Soviet Union now history, his army defecting from beneath him, and the mujahidin closing on Kabul that he sought refuge at the UN office in the capital, leaving the city in the hands of the rival ethnic and regional mujahidin militias.
The leaders of the mujahidin groups agreed to establish a leadership council. This council quickly came under the control of Professor Burhanuddin Rabbani who was subsequently elected President by the council. Fighting broke out in August 1992 in Kabul between forces loyal to President Rabbani and rival factions. A new war for the control of Afghanistan had begun.
On September 26–27, 1996, the Pashtun-dominated ultra-conservative Islamic Taliban movement captured the capital of Kabul and expanded its control to over 90% of the country by mid-2000. The Taliban were led by Mullah Mohammed Omar. Ousted President Rabbani, a Tajik, and his defense minister Ahmad Shah Masoud relocated to Takhar in the north. Rabbani claimed that he remained the head of the government. His delegation retained Afghanistan's UN seat after the General Assembly deferred a decision on Afghanistan's credentials. Meanwhile, the Taliban removed the ousted PDPA leader Najibullah from the UN office in Kabul, tortured and shot him, and hung his body prominently in the city. General Rashid Dostum, an ethnic Uzbek, controlled several north-central provinces until he was ousted on 25 May 1997 by his second in command Malik Pahlawan. Dostum fled to Turkey, but he returned that October. The Shia Hazara community, led by Abdul Karim Khalili, retained control of a small portion of the center of the country.
After the fall of the Taliban, various warlords, leaders, and political factions emerged in Afghanistan. Dostum, as head of Jumbish-e Melli Islami (National Islamic Movement), consolidated his power in Mazar-i-Sharif. He was named interim deputy defense minister for the transitional government in 2002. Rabbani, as nominal head of the Northern Alliance, is also the leader of Jamiat-e-Islami, the largest political party in the alliance. Ismail Khan, a Shiite warlord of Tajik origin earned a power base in the western city of Herat by liberating it from Soviet control, and for a time in the '90s, kept it from Taliban control. Khan is thought to be receiving backing from Iran. Abdul Karim Khalili is the leader of the Hezb-e-Wahdat (Unity Party) and the top figure in the Shia Hazara minority. Wahdat is the main benefactor of Iranian support, and the second most-powerful opposition military party. Gulbuddin Hekmatyar, the most notorious of the warlords who emerged from the fight against Soviet occupation, leads the party Hezb-e Islami. Pir Syed Ahmed Gailani is a moderate Pashtun leader and wealthy businessman who is also the spiritual leader of a minority Sufi Muslim group. Gailani is supported by pro-royalist Pashtuns and Western-educated elites of the old regime. He has called for an Islamic constitutional republic. Former King Zahir Shah, who said he had no intention of returning to power, volunteered to help build a power-sharing administration for the country. Shah is a Pashtun. Younis Qanooni, an ethnic Tajik, who was named Interior Minister for the interim government, was also the interior minister in the country's previous interim administration, in 1996, before the Taliban came to power, and has opposed the presence of U.N. peacekeepers in Afghanistan. And Abdullah Abdullah, of the Northern Alliance, was a close friend of Ahmad Shah Masoud. Like Masoud, Abdullah is from the Tajik heartland of the Panshir Valley, but his mother is Pashtun. He has been seen as less willing to relinquish the Northern Alliance's grip on power.