By 1989, the mujahideen had driven the Soviets from Afghanistan, and three years later, in 1992, they managed to wrest control of the government in Kabul from the Marxist president, Muhammad Najibullah.
Severe infighting among the mujahideen factions continued, however, under the presidency of mujahid leader Burhanuddin Rabbani. Their war against each other devastated Kabul: tens of thousands of civilians lost their lives, and infrastructure was destroyed by rocket fire.
This chaos, and the exhaustion of the Afghans, permitted the Taliban to gain power. Cultivated by Pakistan, the Taliban emerged first in Kandahar, gained control of Kabul in 1996 and controlled most of the entire country by 1998. Their extremely severe laws based on retrograde interpretations of the Quran, and absolute disregard for human rights, were repugnant to the world community.
For more information on the Taliban:

