Following a military coup in April 1978, the communist People's Democratic Party of Afghanistan took power. The party was riven by sectarian disputes and, in December 1979, the Soviet Union intervened in support of Babrak Karmal who was installed as president. Military conflict ensued between the Afghan army and opposition Mujahedin forces, who were themselves factionalized. The Soviet Union became involved, committing thousands of troops to action. This failed, however, to secure stability for the new communist regime and security beyond the area around the capital, Kabul, was never established.
Soviet military involvement in Afghanistan was a key factor leading to the end of détente and to more hostile relations between Moscow and the United States in the first half of the 1980s. The large number of Soviet casualties also had a profoundly radicalizing impact on politics in the Soviet Union itself after the election of Mikhail Gorbachev as General Secretary of the Communist Party of the Soviet Union in March 1985 and the introduction of perestroika. In line with Gorbachev's policy of ‘new political thinking’, the Soviet Union announced a timetable for withdrawal from Afghanistan which was completed in 1989. The Afghan communist regime fell in 1992.