From Wikipedia
The Soviet War in Afghanistan, also known as the Soviet–Afghan War or the Soviet Invasion of Afghanistan; was a nine-year conflict involving the Soviet Union supported by the Democratic Republic of Afghanistan; established by the Marxist People's Democratic Party of Afghanistan (PDPA) at their own request, against the majorly Pakistan-backed Islamist Mujahideen Resistance. The mujahideen found support from a variety of sources including the United States, Saudi Arabia and other Muslim nations through the context of the Cold War.
The initial Soviet deployment of the 40th Army in Afghanistan began on December 24, 1979 under the leadership of communist party secretary, Leonid Brezhnev. The final troop withdrawal started on May 15, 1988, and ended on February 15, 1989 under the last head of state of the Soviet Union, Mikhail Gorbachev. Due to the interminable nature of the war, the conflict in Afghanistan has often been referred to as the Soviet's Vietnam; in relation to the Vietnam War.