And what Soviet leader(s) was in charge of this?
Great question! The Soviets invaded Afghanistan due to the Brezhnev Doctrine. The Brezhnev doctrine had been declared as a post hoc justification for the Soviet led Warsaw Pact invasion of Czechoslovakia.
It stated that:
"When forces that are hostile to socialism try to turn the development of some socialist country towards capitalism, it becomes not only a problem of the country concerned, but a common problem and concern of all socialist countries."
Essentially this meant that any country that was Marxist-Leninist that exhibited signs of a threat to becoming capitalist would be invaded to prevent that capitalist or democratic transition. Brezhnev was justifying the Soviet decision to invade and stop the Prague Spring, in which the Communist Party of Czechoslovakia had decided to hold free elections in the next election.
So, why did the Soviets invade Afghanistan?
Well, in 1978 the Saur Revolution happens and the communists in Afghanistan gain control of the country. They proclaim a government and the Soviets begin to prop them up. However, there were two internal power struggles in the government, the first one in which the pro-Soviet politicians lost, and the second in which one leader usurped another.
That leader, Amin, was unpopular with the people and the Soviet Union. As religious tensions lead to unrest and the country seemed ripe for revolution, the Soviets sent a death squad to assassinate Amin and occupied the country in the same day.
This was done to keep the communist state of Afghanistan (The Democratic Republic of Afghanistan) afloat.
The Soviet leader in charge was Brezhnev, but this would move to Andropov, Chernenko and finally Gorbachev who pulled out the last troops in 1989.
Sources:
Afgantsy: The Russians in Afghanistan, 1979–1989
My general knowledge of the situation.
This prompted me to ask another question about events preceding this. I think it is a separate discussion. I'm getting the "you're either a brand new user or your posts have not been doing well" error, neither of which is true, and I have not posted here for 6 months. Could a mod or another user post this question?
###How did a communist regime gain control (however briefly and tenuously) in Afghanistan in 1978?
Given what we know of the country today, the idea of bringing atheistic communism to such a old-fashion Islamic people seems absurd and bound to have tragic consequences. There has been a lot of reporting on the aftermath, from the Soviet invasion to the invasion after Sept. 11th. However the most perplexing part is how the Reds gained power in Kabul, regardless of Soviet aid.
How did this movement get as far as it did?
Russia had a relationship of dominance with Afghanistan since before the USSR even existed. In 1907, the Russian Tsarist regime signed a treaty demarcating Afghanistan as basically a buffer zone between Russian influence and British influence in British-occupied India (including present-day Pakistan).
After the Tsar was overthrown by the Bolsheviks, they threw out the previous treaty and claimed to support anti-colonial (that is, anti-British) sentiment in Afghanistan. However, the Communist movement in Afghanistan was weak, and the dominant Soviet doctrine was the belief that even reactionary elements in a given country should be supported in their rejection of capitalist states, when not communist. Basically this was a fancy of justifying Soviet pragmatism -- they would support elements in Afghanistan that were rejecting British influence, even if those groups were not Communist.
By 1978, the USSR-backed PDPA had overthrown a liberal reformist leader in Afghanistan who had failed to economically modernize Afghanistan. The PDPA was largely rejected by Afghan society. When it failed to properly subjugate the Afghan public at the desire of the Soviet Union, the Soviets invaded and killed the PDPA leader at the time, Amin, whom they viewed as a liability.
That's my understanding of it at least. Basically, it's important strategic terrain and has been for Russia for over a century, especially when dealing with outside influence in Pakistan.
Good answers here, but I have quite a bit to add. I'm actually writing a thesis about the invasion and the subsequent war, so I've read quite a bit of the applicable literature.
The Soviet Union ultimately invaded Afghanistan because of a complicated combination of Afghan domestic politics and cold war geopolitics.
I'll start in 1973, when Daoud overthrew his cousin, Zahir Shah, taking the reigns in Kabul. Daoud, in his previous role as Prime Minister, had developed ties with the Soviet Union, which included sending promising young Afghans to the USSR to be educated, but of course part of this education was indoctrination into communism. As a result, there was a growing communist movement in Kabul by the time Daoud overthrew his cousin in 1973. In his previous stint as PM of Afghanistan, Daoud had also managed to royally piss of Pakistan by stirring up ethnic tensions over the Durand line, so when Daoud begun to crack down on Islamists both in Kabul and in the rural areas, Pakistan promptly started to turn them into a low level Islamic insurgency. Daoud and his successors would devote more effort to tamping down this Pakistan-backed insurgency then they would to almost anything else.
Meanwhile, the Khalqis, the radical faction of Afghanistan's Communist Party (as opposed to the Parchams, the less radical faction that Daoud had aligned with) were working on developing contacts within the military and with the Soviet Union, and overthrew Daoud in 1978, installing Taraki, a close ally of the USSR as president
In 1977, Zia-ul-Haq (Zia for short), the new dictator of Pakistan, had taken power in Islamabad at a time of deep division in Pakistan's own society. Facing deep divisions, some of which were ethnic in nature, and facing the previous loss of East Pakistan (today known as Bangladesh,) Zia saw a politically Islamic identity as the best way to hold the country together, and would align the Pakistani State with a number of different Islamic causes, including the anti-communist cause in Afghanistan. Zia begun to accelerate the aid program to the Afghan mujihadeen, who were poorly armed and poorly trained, but so were the Afghan army, who by this point, were confused by the leadership changes. Egged on by Pakistan, some units of the Afghan army were even nearing open revolt against Kabul.
At the same time that the Daoud-Zia feud was playing out over the Durand Line, there was a shift in the Cold War balance of power. Over the past two decades, relations between China and the Soviet Union had deteriorated to the point where the two countries were literally threatening nuclear war with each other, shots were fired, and people were being killed on the border. In 1973, shortly before Daoud's coup, the Nixon administration began the first in a series of visits to China that would bring the United States and the PRC into an informal alliance against the Soviets.
So if I'm Brezhnev, here's the situation in 1978: I'm on the verge of nuclear war with my neighbor to the South (China), the US is a constant threat, and the Pakistanis, close allies of both the US and the PRC, are arming an insurgency against my allies to the south. Of course I'm going to respond by giving Taraki military aid...
Well, Taraki has a bit of a problem. One of his ministers and allies, this guy Amin, is also one of his fiercest rivals for power and has been for quite some time. Amin has spent time in the US, has worked for an American embassy, and may very well have contacts with the American government. He's clearly vying for power, and it looks like he's going to get there.
Taraki has another little problem, in the sense that his army is entering open revolt against him and his Soviet allies. In March of 1979, a group of Afghan Army soldiers massacred dozens of Soviet advisers, and brought their weapons into the mountains. Other Army units followed. The situation with the Islamists was getting out of control, and the last thing that the Soviets needed was for Taraki's right hand man to make trouble for him, so they began to plant stories that he was a CIA agent in the hopes to discredit him. This effort failed though, and in September of 1979, Taraki lay dead at the hands of Amin.
Here's where things get weird: The KGB had spent so much effort planting stories about Amin's CIA ties that they actually began to believe their own propaganda. KGB cables to the Kremlin from this period are filled with clear directives that they need to overthrow Amin or the CIA is going to station ICBMs in Afghanistan to Target the USSR where it's weak. The KGB genuinely believed their own propaganda about Amin, and believed that his coup was a CIA plot.
The situation with the Islamists only got worse with Amin in power, and by 1979 the US had begun to send small amounts of aid to the Islamic insurgency, routing it through Pakistan. Iran, which had just gone through its own Islamic revolution, was also aiding the mujihadeen at this point, hoping to export their revolution across the Islamic world. Amin was radioing in for help from the Soviets, who were secretly plotting to kill him, and after a number of failed assassination attempts, they used the soldiers that Amin had requested to kill him and install Babrak Karmal as the Afghan president.
Since your question was only about why the Soviets invaded, I won't go much further than this but to say that the US, the PRC, and Pakistan almost immediately begun to seriously escalate their aid to the mujihadeen, forcing the Soviets to engage in a long term occupation and stabilization effort that, as history shows, failed miserably.
Further reading and sources: As I said earlier, I'm writing quite a bit about this war for my thesis, so I'll leave you with a chapter to read, which is more or less a seriously expanded yet still incomplete version of what I posted, and includes all of my sources at the bottom.
Follow-up question; VM Zubok in A Failed Empire. The Soviet Union in the Cold War from Stalin to Gorbachev says the following about the Soviet-Afghan war: "In retrospect, the invasion of Afghanistan, despite its initial succes, presents itself as one of the first signs of the Soviet Imperial Overstretch."
I've always found Imperial Overstretch a difficult to understand notion, and I was hoping someone could further expand on what Zubok means by this.
Good replies in this thread. To add a bit more context about the power struggle/collapse that "necessitated" the invasion...
As mentioned there were two factions within the Party that vied for power. They were largely motivated by institutional and fast tracked socialism and revolutionary changes in society/religion (banning child marriages, state sponsored atheism, etc) for the Khalq faction and more gradual institutionalization and tolerance for Islam by the Parchamis. The former were peasant based and from the nations poor while the Parcham faction was largely urban intelligentsia. There were also fairly strict tribal separations between the two factions as well, with a large portion of Khalq being Pashtuns.
These circumstances already made for nasty in fighting with the Khalq's tribal make up forcing their faction through even more. The Khalq's more "Orthodox" Marxism and the Parcham's bourgeoisie origins served as a springboard for criticizing the Parcham faction.
The Khalq faction is the one that came into power post Saur and Daoud and their Orthodox political line alienated a large portion of the country. The Parcham faction had worked with the Daoud government prior to the PDPA coming to power and spied for the USSR while doing so, increasing their relationship and ties. The Khalq faction attempted to purge the Parchams from the government, which was resisted by the USSR.
Long story short, Amin's destabilizing political policies, animosity towards the other faction and growing animosity towards the USSR prompted the USSR to replace him and invade.
Sources are The Sickle and the Minaret as well as The Soviet Invasion and the Afghan Response