In the 1970s, Afghanistan was in turmoil. Over a short period, the government violently changed from a monarchy in 1975 to a new Soviet-friendly government in 1978. The new leader, Nur Mohammad Taraki, gained the support of Leonid Brezhnev and the Soviet Union. However, Afghanistan is an unstable country and Taraki was soon overthrown and executed by Hafizullah Amin, who became the new leader of the socialist republic (1980: Invasion of Afghanistan). The Soviets saw Amin as a threat to socialism in Afghanistan, especially given the lack of popular support for the government, and the media called him deceptive and an enemy of the revolution (Petrov). Amin had been a key member of the Taraki government and the two had a close relationship during the revolution, but their relationship became tense after they rose to power.
On Christmas Day 1979, Soviet troops invaded the country of Afghanistan in South Asia in order to prop up their ally. They claimed that Afghanistan was under the pressure of imperialism and need support to further to April Revolution (Petrov). The People’s Democratic Party of Afghanistan was threatened and requested support from the Soviets, so they obliged. Two days after the Soviets invaded, Amin was ousted and Babrak Karmal was flown in from the Soviet Union and installed as the new leader (1980: Invasion of Afghanistan). One aspect of the Soviet invasion that the new Afghan government used as a positive consequence was the return of Afghans to their home country (Statement). However, the new government still did not have the popular support necessary
The invasion into Afghanistan started a war that would last almost a decade. It cost the Soviets many lives, resources, and extreme amounts of money to fight a protracted war in the mountainous country. The war gave further enraged the religiously motivated anti-Soviet and anti-government forces in Afghanistan, known as the mujahideen, a group in which Osama bin Laden got his start and the Peshawar Seven rose to prominence. The mujahideen eventually gained the financial support of the United States and other foreign powers, making the job of the Soviets even harder. Afghanistan became a furnace in which the Soviets burned up military supplies, resources, and revenue to continue a war that it would ultimately lose. The Soviets withdrew in February 1989 and Afghanistan thrown into an internal civil war for several more years before the rise of the Taliban established a stable government. The Afghan war proved to be a major blow to Afghan to Soviet military and weakened its esteem in the international community.

Sources:
Seventeen Moments: 1980: Invasion of Afghanistan, http://www.soviethistory.org/index.php?page=subject&SubjectID=1980afghanistan&Year=1980
Statement by the Government of Afghanistan: http://dlib.eastview.com/searchresults/article.jsp?art=2&id=13624420
A. Petrov, On Events in Afghanistan: http://dlib.eastview.com/searchresults/article.jsp?art=0&id=13629304