Who won the Soviet-Afghan war?
This is a common question with no short answer to it. Just like most questions related to this strange war. Yet, we can assess every side of this war separately and see what they gained and lost at the end of the conflict.
Did the USSR win the Soviet-Afghan war?
There is a common myth spread by Soviet and now Russian propaganda, that Soviet Army did not loose a single battle and therefore won the war, at least militarily. This statement is partially true. Comparing to the modern day Russian achievements in Ukraine, the Soviet Union was able to achieve some military successes during the war, including the capture of key cities and the suppression of some insurgent groups. However, the military victory is rarely useful without the political one.
The Soviet Union did not achieve a political victory. Soviet puppet government in Kabul was uncapable of controlling the whole country even with the Soviet troops present. The collapse of the Afghan communist institutions started with the withdrawal of the Soviet troops from Afghanistan. In the next three years, the official Kabul government tried to maintain control but ultimately failed in 1992. Well, that was still one year longer than the Soviet Union itself.
One could argue that the Soviet Army at least got some valuable experience from the war and improved its own army, based on it. This, however, did not happen. Soviet Union had its own very stable doctrine, which could not be interfered by what was seen as a local and unimportant conflict. The results of such ignorance ended up in devastating losses during the First Chechen War.
Did Afghanistan get anything from the ending of the conflict?
To most the answer seems negative. However, as usual, it's not all that simple. Of course, Afghanistan suffered during the war. Around one million people were killed from different causes and up to 6 millions fled the country forever. In terms of the country development, it is probably safe to say, that the Soviet Union left the country in the more developed shape, than it found it. However, at a cost of million lives. Is it a fair exchange?
Next, Afghanistan was not a united front. The communist government relied on Soviet troops, while mujahedeen's were fighting against them. So, while the withdrawal of the Soviet Army was a clear sign of victory for the mujahedeen, it was a bit more complicated for the official government.
At the end, there were no major victors in Afghanistan, since after the Soviet withdrawal, the ongoing civil war continued with more flame. We all know how it ended up - and it was not a desired outcome for most fractions.
Did anyone had a decisive victory in Soviet-Afghan war?
Biggest gains were achieved by the outside players, those who did not directly participate in war. Both regional and international players got something for themselves out of this conflict. For example, countries like Iran and Pakistan got quite a few refugees, who entered their country and stayed there. This gave a little boost to their economy in a long run, with like-minded people of the same religious and tradition background.
But of course the biggest gainers were the other two international superpowers of the time - China and USA. While they did not gain anything big directly from the Soviet-Afghan war, the collapse of the Soviet Union was definitely in their favor.
In short, there was no clear "winner" of the Soviet-Afghan War. While the Soviet Union was able to maintain its influence in Afghanistan for a period of time, they were ultimately unable to achieve their objectives and were forced to withdraw their troops. The conflict was ultimately a costly and difficult experience for both sides, with significant long-term consequences.