The war was an attempted invasion by the USSR. However, the Taliban forces were funded, trained and supplied by the US. They gave them anti-aircraft missiles to take down Soviet attack helicopters and caused such a terrible loss for the Soviet forces that the attack was abandoned as it was really bad propaganda for them. They needed to pull out before it became really bad.
After this, Ronald Reagan became president. He was a staunch anti-communist. This led to a period of heightened tensions between Russia and America undoing a lot of the work that Nixon had tried to achieve. This was nicked named the Second Cold War and led to a worrying time for both of the countries population. It was very similar to the troubling times in the 1960s where both countries were ready to attack at a moments notice.
However, at the beginning of Reagan’s second term, he became much friendlier with the Russian premier, Mikhail Gorbachev, and this led to the friendliest terms between the two countries since long before the Cold War. He stood in front of the Berlin Wall at one point and, in a speech, told Gorbachev “If you seek peace, if you seek prosperity for the Soviet Union and Eastern Europe, if you seek liberalization: Come here to this gate! Mr. Gorbachev, open this gate! Mr. Gorbachev, tear down this wall!” This speech came at a time when the Soviet Union was failing and could not support itself, let alone the countries it controlled in Eastern Europe and Asia. It was delivered in 1987 and just two years later, the Berlin Wall fell and the countries of Eastern Europe were once again in control over their own governments.
In conclusion, the period of 1970 to 1990 was a bit of a rollercoaster for America as they moved from the brink of war to peace and then back again before playing a major role in the collapse of the biggest threat to the US ever before. They helped broker deals, then destroyed them all without disturbing the balance of the world and tipping it towards all out nuclear war.