On 12 December 1979, the Politbureau of the Central Committee of the Communist Party of the Soviet Union adopted the secret resolution 176/125 "On the situation in `A'", where A stands for Afghanistan. It was the decision to deploy Soviet troops in Afghanistan.
After the bloodless coup in 1973, when Daoud dethroned the shah, Daoud launched reforms, trying to modernize the country. He disbanded the parliament, banned all political parties and formed an authoritarian regime. His reforms were not supported neither by the fundamentalists, nor by the pro-communist factions. In 1978, after the still mysterious murder of a leader of the pro-communist party PDPA Mir Akbar Khyber, PDPA revolted and Daoud was killed during the coup. The Soviet government was caught in surprise, but they decided to provide economic support to the socialist reforms undertaken by the new leader, Taraki. The reforms were radical. Islam was proclaimed "the religion of the exploiters", the tribal customs and religious traditions were dismissed. The programs of democratization, liquidation of illiteracy and national discrimination were launched. It caused the rise of the fundamentalist opposition. At the same time, Taraki instilled the "cult of personality" absolutely in the style of Stalin. Party members wore badges with his portrait, museums were built where he had lived, during the meetings at least five portraits of Taraki had to be hanged, he was called "the father of the peoples of Afghanistan" and "the great leader of the revolution and the teacher of the workers" and so on. Moscow was aware of the growing opposition to Taraki and PDPA. In July 1979, the US administration began a propaganda campaign and financial aid to the fundamentalists, trying to increase the resistance to the pro-Soviet regime. The main competitor of Taraki, though, was not the fundamentalist opposition, but his deputy, Amin. Even more than the Kremlin, Afghanistan reminded of the bulldogs fighting under the carpet. Taraki attempted to poison Amin, but failed. In the end, Amin himself killed Taraki in October 1979. But it didn't help him. The attempts to assassinate him continued. In the meanwhile, the Soviet political advisors only attempted to stabilize the situation. The Kremlin did not like working with the successor, whose politics was too much like the one led by Taraki. Former prime-minister of Afghanistan Sultan Ali Keshtmand wrote that the regime of Amin was totalitarian. The repressions were getting even worse. Soviet diplomats even had to convince him to drop his plans to include the "dictatorship of the proletariat" in the constitution of Afghanistan.
Both Taraki and Amin insisted that the USSR should deploy the troops in Afghanistan, but the Soviets refused. Since January 1979, they supplied weapons to the Afghanistan government, sent military advisors, doctors and engineers there and were very unwilling to do anything else. The brutality of the Amin's regime finally convinced them that something has to be done. The first Soviet detachments were deployed in Afghanistan in July 1979, they had to guard the airport in Bagram and the embassy, but in November 1979, the Soviet government considered the possibility of the mass deployment.
On 12 December, the Politbureau adopted the resolution 176/125. The gist was that Hafizullah Amin must be replaced by Babrak Karmal and that the troops had to be deployed in Afghanistan to stabilize the situation. The task of the military was not clearly defined. It was formulated in the most vague diplomatic terms. The army was not certain what they were expected to do. Hence, numerous errors in the preparation phase.
In the end, the Soviets entered Afghanistan, occupied the Amin's palace (Amin was found dead inside) and became involved in the feudal wars. More than 14,000 Soviet soldiers were killed. Almost half a million were wounded or sick. Karmal had to resign in 1986 and his place was taken by Najibullah. In 1989, the Soviet army left Afghanistan. Soviet and Russian generals agree that it was not a loss or the war, that they have fulfilled the tasks: the friendly government survived, the opposition was contained, the mujahideen never captured a single city or ran a single large scale offensive and the Soviet troops, buildings and communications were safe. Humanitarian goods were delivered in time. All actions of the Soviet 40th army in Afghanistan were either preventive or retaliation strikes.
However, after the end of the operation it was the task of the diplomats and politicians to prevent the creation of an inimical state on the borders of the USSR, and they failed.
The USA, who did their best trying "to induce a Soviet military intervention", later spent hundreds of millions of dollars supporting the fundamentalist opposition. In exchange, they have got Al Qaeda, which was born in Afghanistan, in the camps of the anti-Soviet mujahideen. Such is the sad story of the end of the Cold War.
Photographs taken from the following web pages (click to see more):soldat.ru
Update @2008-12-12 23:40: Oh, and the Afghanistan payed for independence with the never-ending civil war. Eventually, they somehow ended up losing the independence again. Sometimes I think that the best that could have happened for all interested sides would be if the Afghans had decided to join the USSR :)