On 24 September 1979, lead elements of the Soviet 40th Army were ordered to cross the border into Afghanistan. Three days later, Soviet Airborne forces had seized the airfields in Kabul and Bagram, and the Afghan President H. Amin had been executed.
This was the beginning of a political and military disaster for the Soviet Union that lasted for nine years with a cost of almost 15,000 troops reported killed or missing in action.<1> Thousands of additional Russian soldiers were wounded or died of disease, and millions of Afghanis were either killed, wounded or became refugees.
The most important lesson that the Soviets learned from their experience in Afghanistan was, according to Cordesman and Wagner, "that it never should have been fought".snip
Pakistan, like Cambodia during the U.S. war in Vietnam, was a Mujahideen sanctuary from Soviet forces that were unwilling to cross the international border into the country. These sanctuaries provided the Afghan resistance with a safe area to train recruits, plan combat operations, and build a logistics support structure.
Arguably the most important factor in the overall failure of the Soviets to achieve a strategic victory in Afghanistan, Pakistan, according author and scholar Milan Hauner, "was vital for the continuation of the Mujahideen resistance."<10> Military supplies and weapons were supplied from Egypt, China and the United States with additional funding coming from Islamic countries such as Saudi Arabia. The U.S. Central Intelligence Agency (CIA) coordinated with Pakistan's Inter-Services Intelligence Directorate (ISI) to distribute aid to the resistance. Soviet style weapons such as AK-47 rifles and SA-7 anti-aircraft missiles were delivered, as these "Soviet" weapons were similar to those captured from the Russians and could not be directly traced back to the United States.<11> Eventually, more sophisticated weaponry and equipment such as Stinger missiles, advanced communications equipment, and heavy weapons were
funneled through Pakistan to the Afghan resistance. snip
In addition to the political miscalculations towards the United States and Pakistan, the
Soviet leadership equally miscalculated the strength, motivations, and will of the Afghan resistance organizations.
The Mujahideen were never a united force fighting for a common goal or centrally led.
The resistance in Afghanistan consisted of a variety of ethnic groups who often had very different and conflicting political and military objectives.
They were however united against a common enemy, the "Godless Communists". The greatest strength of the Mujahideen and the Afghan people was their remarkable resilience. The resistance fighters and the Afghan people who supported them carried on the conflict despite heavy civilian casualties, millions of refugees, poor communications, weapons, and equipment, and the overwhelming technical superiority of the Soviet Army. Despite all their efforts, the Soviets, according to Lester Grau, "did not understand who they were fighting."<15>
The main forces of the Soviet 40th Army were positioned in Afghanistan by January 1980.
They were completely unprepared for the kind of guerrilla war waged by the Mujahideen. snip
The major lessons the Soviets learned during the war in Afghanistan were according to Cordesman and Wagner that,
"It is virtually impossible to defeat a popular guerrilla army with secure sources of supply and a recovery area; it is extremely difficult-if not impossible –to use modern weapons technology to cut off a guerrilla force from food and other basic supplies; and the success of pacification techniques depends on the existence of a popular local government, and the techniques must be seen as the actions of the local government and not of foreign military forces."<45> .......They failed to understand their enemy and the power Islamic Nationalism had on the will of the Afghani people to endure extreme hardships. They were unable or unwilling to prevent the Mujahideen from operating from sanctuaries in Pakistan.
..... In the end however, the Soviets failed to reach their political or military objectives in Afghanistan.
http://www.militaryhistoryonline.com/20thcentury/articles/sovietexperience.aspx