In 1979, Iran was replaced with an extremist Islamic government, so Afghanistan was an important buffer to prevent Irans new ideology from spreading to the Soviet Union
Amin staged a coup against the pro-soviet government in Afghanistan, taking over Afghanistan. The soviet union was fine with this however as Amin became extremely unpopular, he seeked support from the USA
After Amin asked the USA for support, the soviet union got angry and invaded Afghanistan, claiming to help Amin againsts terrorists trying to overthrow him. However, three days later Amin was assassinated
After Amin was assassinated, he was replaced with a pro-soviet government called Kamal
After the invasion of Afghanistan by the USSR, Carter announced the Carter Doctrine, which stated that the US would extent its policy of containment to the middle east
In 1980 the USA boycotted the Moscow Olympics in protest at the invasion of Afghanistan. The USSR would return the favour by boycotting the 1984 Olympic Games in Los Angeles
The USA may have overreacted to the soviet invasion of Afghanistan in attempt to leave detente, which showed they didnt want a good relationship with the Soviet Union
In 1978, pro-Soviet soldiers led by Nur Mohammed Taraki overthrew the Afghani government and set up a communist state. The reforms were met with a violent reaction from local warlords. A civil war began.
Then in October 1979, Taraki was killed as Afghan leaders battled for power. Hafizullah Amin became Afghan President, some think with Soviet blessing.
The soviet union invaded afghanistan in December 1979
Taraki signed a '20 years of peace' treaty with the soviet union
The USA feared that communist influence spreading from Afghanistan to Iran would cut off their oil supply
The carter doctrine of January 1980 proposed:
Breaking off of the trade agreements at Helsinki
USA would use force in the middle east if needed
Terrorists such as Osama Bin Laden were offered money and weapons from the US, as they were fighting against Soviet control in Afghanistan