Afghanistan Civil War (1989-1994)
- See also: Taliban
The Afghanistan Civil War (1989-1992) covers the period between the withdrawal of Soviet forces from Afghanistan in 1989 and the taking of control by the Taliban in 1994 is actually one of several civil wars in Afghanistan, but is a way to break up what is otherwise a very long Afghanistan War (1978-92). Dividing that conflict is useful because the two parts, the fight against the Soviets, and the struggle for control after they left, have very different motivations and relationships with countries and ideologies outside Afghanistan.
After the Soviets withdrew in 1989, an unpopular pro-Soviet government remained in place, eventually overthrown by the mujahideen resistance groups, who were by no means unified.
After 1990 a new organization arose, the Taliban, a militantly anti-modern group that was strongly opposed to the mujahideen, and both anti-American and anti-Soviet. It never received direct aid from the US,  although aid to all the participants against the Soviets had U.S. aid channeled, almost completely, through Pakistan's Inter-Service Intelligence (ISI). Pakistan was intimately involved in the entire situation, with contacts on all sides; this was an artifact, in part, of the U.S. and Saudi Arabia channeling funding through ISI.
The Taliban took control of Kabul in 1994, and installed a very harsh Salafist regime. Later it invited in Osama bin Laden and his al-Qaeda group, which established its base in Afghanistan. A substantial part of al-Qaeda's preparation for the 9-11 attack was done in Afghanistan, under Taliban protection, triggering the 2001 invasion. There were, however, lesser U.S. attacks and planned attacks on al-Qaeda in Afghanistan before 2001.
The last Soviet troops left in February 1989, but Soviet military aid continued until the fall of communism in the Soviet Union in 1991.
The Najibullah regime lasted another three years, until a military offensive by the mujahideen captured Kabul in April 1992.
Nine major factions opposed them.
While the Central Intelligence Agency had stayed outside Afghanistan while the Soviets were in the country, a station under Gary Schroen established itself, in Pakistan, besides the regular Islamabad under Milton Bearden]. Pakistan was no friend of the Najibullah government, and planned, with the CIA, to overthrow it.  Neither the ISI nor the CIA, however, had control of the opposition.
An interim government formed under President Burhanuddin Rabbani, a Tajik. It certainly was not in overall control. In the west around Herat, Ismail Khan controlled several provinces. There was a loose eastern group involving Jalauddin Harqqani, centered in Jalalabad.
After the fall of the Soviet Union, Pakistani foreign and economic policy set great value on having a land route to the former Soviet Central Asian Republics. Any such route would go through Afghanistan. Pakistan saw its best chance with a Pashtun government, and the ISI first supported Gulbuddin Hekmatyar. Benazir Bhutto, in 1993, favored an alternative route to Turkmenistan, going through Kandahar in south Afghanistan rather than the route from Peshawar to Kabul to Mazar-e-Sharif in the north. 
Early Taliban visibility
There appears to be a mixture of reality and legend in how the Taliban first gained local popularity. Many of the groups that fought the Soviets were run by warlords, and, after victory, ruled as bandits in their localities. Mullah Omar is generally said to have come to prominence by stopping the rapes of Afghan children. 
Attempts at resolution
U.S. attempts during the Clinton Administration involved high-level contacts, from the Secretary of State down, with Pakistan. 
- US State Department (2005), Did the U.S. 'Create' Osama bin Laden? Allegations that the U.S. provided funding for bin Laden proved inaccurate
- Steve Coll (2004), Ghost Wars: the Secret History of the CIA, Afghanistan and bin Laden, from the Soviet Invasion to September 10, 2001, Penguin,pp. 189-192
- Ahmed Rashid (2000), Taliban: Militant Islam, Oil and Fundamentalism in Central Asia, Yale University Press, ISBN 0300089023, pp. 25-26
- Robert Marquand (October 10, 2001), "The reclusive ruler who runs the Taliban", Christian Science Monitor
- Raymond Bonner (December 10, 1997), "U.S. Turns to Pakistan for Help In Resolving Afghan Civil War", New York Times