The Soviet had a keen interest in Afghanistan and felt threatened by the relationship that was building with several of the middle east countries. The biggest concern for Russia was that it would lose control of the communist influence in Afghanistan.
The Soviets invaded Afghanistan in 1979 with the intent of giving support to the People’s Party of Afghanistan in order to put a hold on the insurgency that was growing. Eventually, it got to the point where the Soviets had to send in 100,000+ soldiers into Afghanistan alone with billions of dollars in support of the war.
While it seemed like the support from the Soviets would be enough to bolster the cause the main problem was that the Afghan resistance was also receiving support. This was coming from several other countries that not only included the United States but China and Egypt as well as a few others.
In spite of all the efforts of the Soviets, they had no option but to pull out of the country in 1989. The cost of this war was huge. Not only in dollars but in loss of life and injuries.
The Soviet Union was facing its own demise dealing with its collapse. But, even so, they continued to support the communist regime by supplying them with supplies and arms.
The Civil War
In 1994 Afghanistan found themselves caught up in a civil war. The Taliban came into being and ended up taking control of Kabul by 1956. By the time 1998 arrive the Taliban had taken over control of the majority of the country.
At this time Russia decided to support the Northern Alliance in the hopes they could prevent Afghanistan from becoming a fundamentalist state. The Russians had no use for the Taliban or Al-Qaeda but for their own reasons.