The Soviet–Afghan War lasted over nine years, from December 1979 to February 1989. Insurgent groups known as the mujahideen fought against the Soviet Army and the Democratic Republic of Afghanistan government, mostly in the country's rural countryside. The mujahideen groups were backed by the United States and Pakistan, making it a Cold War proxy war . Between 562,000  and 2,000,000 civilians were killed and millions of Afghans fled the country as refugees,    mostly to Pakistan and Iran .
Prior to the arrival of Soviet troops, the communist People's Democratic Party of Afghanistan took power after a 1978 coup , installing Nur Mohammad Taraki as president. The party initiated a series of radical modernization reforms throughout the country that were deeply unpopular, particularly among the more traditional rural population and the established traditional power structures.  The government vigorously suppressed any opposition and arrested thousands, executing as many as 27,000 political prisoners. Anti-government armed groups were formed, and by April 1979 large parts of the country were in open rebellion.  The government itself was highly unstable with in-party rivalry, and in September 1979 Taraki was killed under orders of his rival Hafizullah Amin , the Minister of Foreign Affairs and now the president. Deteriorating relations and worsening rebellions led the Soviet government, under leader Leonid Brezhnev , to the 40th Army on December 24, 1979.  Arriving in the capital Kabul , they staged a coup ,  killing president Amin and installing Soviet loyalist Babrak Karmal from a rival faction . 
In January 1980, foreign ministers from 34 nations of the Islamic Conference adopted a resolution demanding "the immediate, urgent and unconditional withdrawal of Soviet troops" from Afghanistan,  while the UN General Assembly passed a resolution protesting the Soviet intervention by a vote of 104–18.   Afghan insurgents began to receive massive amounts of aid and military training in neighboring Pakistan and China,  paid for primarily by the United States and Arab monarchies in the Persian Gulf .    As documented by the National Security Archive , "the Central Intelligence Agency (CIA) played a significant role in asserting U.S. influence in Afghanistan by funding military operations designed to frustrate the Soviet invasion of that country. CIA covert action worked through Pakistani intelligence services to reach Afghani rebel groups."  Soviet troops occupied the cities and main arteries of communication, while the mujahideen waged guerrilla war in small groups operating in the almost 80 percent of the country that was outside government and Soviet control, almost exclusively being the rural countryside. The Soviets used their air power to deal harshly with both rebels and civilians, levelling villages to deny safe haven to the mujahideen, destroying vital irrigation ditches, and laying millions of land mines. 
By the mid-1980s, the Soviet contingent was increased to 108,800 and fighting increased throughout the country, but the military and diplomatic cost of the war to the USSR was high. By mid-1987 the Soviet Union, now under reformist leader Mikhail Gorbachev , announced it would start withdrawing its forces.   The final troop withdrawal started on May 15, 1988, and ended on February 15, 1989, leaving the government forces alone in its battle against the insurgents, which continued until 1992. Due to its length, it has sometimes been referred to as the "Soviet Union's Vietnam War " or the " Bear Trap" by the Western media,   and is thought to be a contributing factor to the fall of the Soviet Union . 
In 1885, Russian forces seized the disputed oasis at Panjdeh south of the Oxus River from Afghan forces, which became known as the Panjdeh Incident . The border was agreed by the joint Anglo-Russian Afghan Boundary Commission of 1885–87. The Russian interest in the region continued on through the Soviet era , with billions in economic and military aid sent to Afghanistan between 1955 and 1978.
After the Saur Revolution in 1978, the Democratic Republic of Afghanistan was formed on April 27, 1978. The government was one with a pro-poor, pro-farmer socialist agenda. It had close relations with the Soviet Union . On December 5, 1978, a treaty of friendship was signed between the Soviet Union and Afghanistan. 
In February 1979, the United States Ambassador to Afghanistan, Adolph Dubs , was kidnapped by Setami Milli militants and was later killed during an assault carried out by the Afghan police, assisted by Soviet advisers. Dubs' death led to a major deterioration in Afghanistan–United States relations .
In Southwestern Asia , drastic changes were taking place concurrent with the upheavals in Afghanistan. In February 1979, the Iranian Revolution ousted the American-backed Shah from Iran, losing the United States as one of its most powerful allies.  The United States then deployed twenty ships in the Persian Gulf and the Arabian Sea including two aircraft carriers, and there was a constant stream of threats of warfare between the U.S. and Iran . March 1979 marked the signing of the U.S.-backed peace agreement between Israel and Egypt . The Soviet leadership saw the agreement as giving a major advantage to the United States. A Soviet newspaper stated that Egypt and Israel were now " gendarmes of the Pentagon ". The Soviets viewed the treaty not only as a peace agreement between their erstwhile allies in Egypt and the US-supported Israelis but also as a military pact. In addition, the US sold more than 5,000 missiles to Saudi Arabia and also supplied the Royalist rebels in the North Yemen Civil War against the Nasserist government. Also, the Soviet Union's previously strong relations with Iraq had recently soured. In June 1978, Iraq began entering into friendlier relations with the Western world and buying French and Italian-made weapons, though the vast majority still came from the Soviet Union, its Warsaw Pact allies, and China.
King Mohammed Zahir Shah ascended to the throne and reigned from 1933 to 1973. Zahir's cousin, Mohammad Daoud Khan , served as Prime Minister from 1954 to 1963. The Marxist People's Democratic Party of Afghanistan 's (PDPA's) strength grew considerably in these years. In 1967, the PDPA split into two rival factions, the Khalq (Masses) faction headed by Nur Muhammad Taraki and Hafizullah Amin and the Parcham (Flag) faction led by Babrak Karmal . 
Former Prime Minister Daoud seized power in a military coup on July 17, 1973 after allegations of corruption and poor economic conditions against the king's government. Daoud put an end to the monarchy, and his time in power was widely popular among the general populace but unpopular among PDPA supporters.
Intense opposition from factions of the PDPA was sparked by the repression imposed on them by Daoud's regime and the death of a leading PDPA member, Mir Akbar Khyber . The mysterious circumstances of Khyber's death sparked massive anti-Daoud demonstrations in Kabul , which resulted in the arrest of several prominent PDPA leaders. 
On April 27, 1978, the Afghan army , which had been sympathetic to the PDPA cause, overthrew and executed Daoud along with members of his family. Nur Muhammad Taraki, Secretary General of the PDPA, became President of the Revolutionary Council and Prime Minister of the newly established Democratic Republic of Afghanistan.
Factions inside the PDPA
After the revolution, Taraki assumed the Presidency , Prime Ministership and General Secretaryship of the PDPA. The government was divided along factional lines, with President Taraki and Deputy Prime Minister Hafizullah Amin of the Khalq faction against Parcham leaders such as Babrak Karmal and Mohammad Najibullah . Within the PDPA, conflicts resulted in exiles , purges and executions of Parcham members. 
During its first 18 months of rule, the PDPA applied a Soviet-style program of modernizing reforms, many of which were viewed by conservatives as opposing Islam.  Decrees setting forth changes in marriage customs and land reform were not received well by a population deeply immersed in tradition and Islam, particularly by the powerful landowners who were harmed economically by the abolition of usury (although usury is prohibited in Islam) and the cancellation of farmers' debts. The new government also enhanced women's rights, sought a rapid eradication of illiteracy and promoted Afghanistan's ethnic minorities, although these programs appear to have had an effect only in the urban areas. By mid-1978, a rebellion started, with rebels attacking the local military garrison in the Nuristan region of eastern Afghanistan and soon civil war spread throughout the country. In September 1979, Deputy Prime Minister Hafizullah Amin seized power, arresting and killing President Taraki. Over two months of instability overwhelmed Amin's regime as he moved against his opponents in the PDPA and the growing rebellion.
The Union of Soviet Socialist Republics (USSR) had been a major power broker and influential mentor in the politics of its poorer and much smaller neighbor. Its involvement ranging from civil-military infrastructure to Afghan society.  Since 1947, Afghanistan had been under the influence of the Soviet government and received large amounts of aid, economic assistance, military equipment training and military hardware from the Soviet Union. Economic assistance and aid had been provided to Afghanistan as early as 1919, shortly after the Russian Revolution and when the regime was facing the Russian Civil War . Provisions were given in the form of small arms , ammunition, a few aircraft, and (according to debated Soviet sources) a million gold rubles to support the resistance during the Third Anglo-Afghan War . In 1942, the USSR again moved to strengthen the Afghan Armed Forces , by providing small arms and aircraft, and establishing training centers in Tashkent ( Uzbek Soviet Socialist Republic ). Soviet-Afghan military cooperation began on a regular basis in 1956, and further agreements were made in the 1970s, which saw the USSR send advisers and specialists.
In 1978, after witnessing India's nuclear test, Smiling Buddha , President Daud Khan initiated a military buildup to counter Pakistan's armed forces and Iranian military influence in Afghan politics. A final pre-war treaty, signed in December 1978, allowed the PDPA to call upon the Soviet Union for military support.
|“||We believe it would be a fatal mistake to commit ground troops. [...] If our troops went in, the situation in your country would not improve. On the contrary, it would get worse. Our troops would have to struggle not only with an external aggressor, but with a significant part of your own people. And the people would never forgive such things"||”|
|— Alexei Kosygin, the Chairman of the USSR Council of Ministers, in response to Taraki's request for Soviet presence in Afghanistan|
Following the Herat uprising , President Taraki contacted Alexei Kosygin , chairman of the USSR Council of Ministers , and asked for "practical and technical assistance with men and armament". Kosygin was unfavorable to the proposal on the basis of the negative political repercussions such an action would have for his country, and he rejected all further attempts by Taraki to solicit Soviet military aid in Afghanistan. Following Kosygin's rejection, Taraki requested aid from Leonid Brezhnev , the general secretary of the Communist Party of the Soviet Union and Soviet head of state , who warned Taraki that full Soviet intervention "would only play into the hands of our enemies – both yours and ours". Brezhnev also advised Taraki to ease up on the drastic social reforms and to seek broader support for his regime. 
In 1979, Taraki attended a conference of the Non-Aligned Movement in Havana , Cuba. On his way back, he stopped in Moscow on March 20 and met with Brezhnev, Soviet Foreign Minister Andrei Gromyko and other Soviet officials. It was rumoured that Karmal was present at the meeting in an attempt to reconcile Taraki's Khalq faction and the Parcham against Amin and his followers. At the meeting, Taraki was successful in negotiating some Soviet support, including the redeployment of two Soviet armed divisions at the Soviet-Afghan border, the sending of 500 military and civilian advisers and specialists and the immediate delivery of Soviet armed equipment sold at 25 percent below the original price; however, the Soviets were not pleased about the developments in Afghanistan and Brezhnev impressed upon Taraki the need for party unity. Despite reaching this agreement with Taraki, the Soviets continued to be reluctant to intervene further in Afghanistan and repeatedly refused Soviet military intervention within Afghan borders during Taraki's rule as well as later during Amin's short rule. 
Initiation of the insurgency
Pakistani aid to insurgents
Afghanistan cemented regional problems with Pakistan, after Daoud pressed his hard-line Pashtunistan policies to Pakistan.  Pakistan retaliated, and Prime minister Zulfikar Ali Bhutto authorized a covert operation under MI 's Major-General Naseerullah Babar .  In 1974, Bhutto authorized another secret operation in Kabul where the ISI and the AI extradited Burhanuddin Rabbani and Gulbadin Hekmatyar to Peshawar , amid fear that Rabbani and Hekmatyar might be assassinated by Daoud.  According to Baber, Bhutto's operation was an excellent idea and it had hard-hitting impact on Daoud and his government which forced Daoud to increase his desire to make peace with Bhutto.  Another part of this operation was to train hard-line Jamiat-e Islami militants against the Daoud's secular government.  However, this operation went into cold-storage after Bhutto was removed from power. 
In June 1975, militants from the Jamiat Islami party attempted to overthrow the government. They started their rebellion in the Panjshir valley (a part of the greater Parwan province ), in the present day Panjshir province , some 100 kilometers north of Kabul , and in a number of other provinces of the country. However, government forces easily defeated the insurgency and a sizable portion of the insurgents sought refuge in Pakistan where they enjoyed the support of Zulfikar Ali Bhutto 's government, which had been alarmed by Daoud's revival of the Pashtunistan issue. 
In 1978, the Taraki government initiated a series of reforms, including a radical modernization of the traditional Islamic civil and especially marriage law, aimed at "uprooting feudalism " in Afghan society.  The government brooked no opposition to the reforms  and responded with violence to unrest. Between April 1978 and the Soviet Intervention of December 1979, thousands of prisoners, perhaps as many as 27,000, were executed at the notorious  Pul-e-Charkhi prison , including many village mullahs and headmen. Other members of the traditional elite, the religious establishment and intelligentsia fled the country.
Large parts of the country went into open rebellion. The Parcham Government claimed that 11,000 were executed during the Amin/Taraki period in response to the revolts.  The revolt began in October among the Nuristani tribes of the Kunar Valley in the northeastern part of the country near the border with Pakistan, and rapidly spread among the other ethnic groups. By the spring of 1979, 24 of the 28 provinces had suffered outbreaks of violence. The rebellion began to take hold in the cities: in March 1979 in Herat , rebels led by Ismail Khan revolted. Between 3,000 and 5,000 people were killed and wounded during the Herat revolt. Some 100 Soviet citizens and their families were killed.  
Killing of the U.S. ambassador
In February 1979, the contentious law and order situation led to a serious diplomatic incident involving United States, Soviet Union and Afghanistan when U.S. Ambassador to Afghanistan Adolph "Spike" Dubs was kidnapped by a mysterious group of militants. They are sometimes alleged to have been part of the radical communist faction, Settam-e-Melli (lit. "National Oppression"), but are also sometimes described as Islamists. The National Oppression reportedly demanded the release of their communist leader Badruddin Bahes, whom the Afghan government denied holding. The government refused categorically to negotiate with the militants, in spite of the U.S. embassy's demands. The U.S. increased pressure on the Afghan government and the Soviet Union, forcefully demanding peaceful negotiations for the release of their ambassador.
Dubs was held in Room 117 of the Kabul Hotel, where the United States sent its embassy and diplomatic staff to negotiate with the communist faction. The Afghan security forces , accompanied by the Russian advisers, swarmed the hallway and surrounding rooftops of the hotel. When negotiations stalled, there was an intense exchange of fire after Russian advisers ordered an assault. Documents released from the Soviet KGB bureau archives by Vasily Mitrokhin in the early 1990s suggest that the Afghan government authorized the assault and that the KGB adviser on scene, Sergei Batrukihn, may have recommended the assault, as well as the execution of a kidnapper before U.S. experts could interrogate him.  All attempts at negotiation failed, and U.S. Ambassador Adolph Dubs was caught in the crossfire, leading to his death. Afterwards the United States formally expressed to Soviet Union its disapproval of the assault by the security forces, putting more stress on U.S.-Soviet relations . 
U.S. aid to insurgents
In the mid-1970s, Pakistani intelligence officials began privately lobbying the U.S. and its allies to send material assistance to the Islamist insurgents. Pakistani President Muhammad Zia-ul-Haq 's ties with the U.S. had been strained during Jimmy Carter 's presidency due to Pakistan's nuclear program and the execution of Zulfikar Ali Bhutto in April 1979, but Carter told National Security Adviser Zbigniew Brzezinski and Secretary of State Cyrus Vance as early as January 1979 that it was vital to "repair our relationships with Pakistan" in light of the unrest in Iran . According to former Central Intelligence Agency (CIA) official Robert Gates , "the Carter administration turned to CIA ... to counter Soviet and Cuban aggression in the Third World, particularly beginning in mid-1979." In March 1979, "CIA sent several covert action options relating to Afghanistan to the SCC [ Special Coordination Committee ]" of the United States National Security Council . At a March 30 meeting, U.S. Department of Defense representative Walter B. Slocombe "asked if there was value in keeping the Afghan insurgency going, 'sucking the Soviets into a Vietnamese quagmire?'" When asked to clarify this remark, Slocombe explained: "Well, the whole idea was that if the Soviets decided to strike at this tar baby [Afghanistan] we had every interest in making sure that they got stuck."  Yet an April 5 memo from National Intelligence Officer Arnold Horelick warned: "Covert action would raise the costs to the Soviets and inflame Moslem opinion against them in many countries. The risk was that a substantial U.S. covert aid program could raise the stakes and induce the Soviets to intervene more directly and vigorously than otherwise intended."
In May 1979, U.S. officials secretly began meeting with rebel leaders through Pakistani government contacts. A former Pakistani military official claimed that he personally introduced a CIA official to Gulbuddin Hekmatyar that month (Freedom of Information Act requests for records describing these meetings have been denied).  After additional meetings on April 6 and July 3, Carter signed a "presidential 'finding'" that "authorized the CIA to spend just over $500,000" on "non-lethal" aid to the mujahideen, which "seemed at the time a small beginning."  Brzezinski later claimed that "We didn't push the Russians to intervene, but we knowingly increased the probability that they would."    According to Brzezinski, he became convinced by mid-1979 that the Soviets were going to invade Afghanistan regardless of U.S. policy due to the Carter administration's failure to respond aggressively to Soviet activity in Africa , but—despite the risk of unintended consequences—support for the mujahideen could be an effective way to prevent Soviet aggression beyond Afghanistan (particularly in Brzezinski's native Poland). 
The full significance of the U.S. sending aid to the mujahideen prior to the invasion is debated among scholars. Some assert that it directly, and even deliberately, provoked the Soviets to send in troops.      Bruce Riedel , however, believes that the U.S. aid was intended primarily to improve U.S. relations with Pakistan, while Steve Coll asserts: "Contemporary memos—particularly those written in the first days after the Soviet invasion—make clear that while Brzezinski was determined to confront the Soviets in Afghanistan through covert action, he was also very worried the Soviets would prevail. ... Given this evidence and the enormous political and security costs that the invasion imposed on the Carter administration, any claim that Brzezinski lured the Soviets into Afghanistan warrants deep skepticism."  Carter himself has stated that encouraging a Soviet invasion was "not my intention."  Gates recounted: "No one in the Carter Administration wanted the Soviets to invade Afghanistan and no one, as I can recall at least, ever advocated attempting to induce them to invade ... Only after the Soviet invasion did some advocate making the Soviets 'bleed' in their own Vietnam."  Conversely, Andrew Bacevich writes that "the prospect of inducing conflict on the scale of Vietnam exerted great appeal" in the White House even prior to the Soviet invasion, as "fomenting trouble in Afghanistan would dissuade the Soviets from meddling in the Persian Gulf."  Chalmers Johnson considered the Soviet invasion "deliberately provoked" by the U.S. 
Although Gates described Director of Central Intelligence (DCI) Stansfield Turner and the CIA's Directorate of Operations (DO) as contemplating "several enhancement options"—up to and including the direct provision of arms from the U.S. to the mujahideen through the ISI—as early as late August 1979, and an unnamed Brzezinski aide acknowledged in conversation with Selig S. Harrison that the U.S.'s nominally "non-lethal" assistance to the mujahideen included facilitating arms shipments by third-parties, Coll, Harrison, Riedel, and the head of the DO's Near East–South Asia Division at the time— Charles Cogan —all state that no U.S.-supplied arms intended for the mujahideen reached Pakistan until January 1980, after Carter amended his presidential finding to include lethal provisions in late December 1979.
Soviet operations 1979–85
The Afghan government, having secured a treaty in December 1978 that allowed them to call on Soviet forces, repeatedly requested the introduction of troops in Afghanistan in the spring and summer of 1979. They requested Soviet troops to provide security and to assist in the fight against the mujahideen rebels. On April 14, 1979, the Afghan government requested that the USSR send 15 to 20 helicopters with their crews to Afghanistan, and on June 16, the Soviet government responded and sent a detachment of tanks, BMPs , and crews to guard the government in Kabul and to secure the Bagram and Shindand airfields . In response to this request, an airborne battalion, commanded by Lieutenant Colonel A. Lomakin, arrived at the Bagram Air Base on July 7. They arrived without their combat gear, disguised as technical specialists. They were the personal bodyguards for President Taraki. The paratroopers were directly subordinate to the senior Soviet military advisor and did not interfere in Afghan politics. Several leading politicians at the time such as Alexei Kosygin and Andrei Gromyko were against intervention.
After a month, the Afghan requests were no longer for individual crews and subunits, but for regiments and larger units. In July, the Afghan government requested that two motorized rifle divisions be sent to Afghanistan. The following day, they requested an airborne division in addition to the earlier requests. They repeated these requests and variants to these requests over the following months right up to December 1979. However, the Soviet government was in no hurry to grant them.
|“||"We should tell Taraki and Amin to change their tactics. They still continue to execute those people who disagree with them. They are killing nearly all of the Parcham leaders, not only the highest rank, but of the middle rank, too."||”|
|— Kosygin speaking at a Politburo session.|
Based on information from the KGB , Soviet leaders felt that Prime Minister Hafizullah Amin 's actions had destabilized the situation in Afghanistan. Following his initial coup against and killing of President Taraki , the KGB station in Kabul warned Moscow that Amin's leadership would lead to "harsh repressions, and as a result, the activation and consolidation of the opposition."
The Soviets established a special commission on Afghanistan, comprising KGB chairman Yuri Andropov , Boris Ponomarev from the Central Committee and Dmitriy Ustinov , the Minister of Defence . In late April 1978, the committee reported that Amin was purging his opponents, including Soviet loyalists, that his loyalty to Moscow was in question and that he was seeking diplomatic links with Pakistan and possibly the People's Republic of China (which at the time had poor relations with the Soviet Union ). Of specific concern were Amin's secret meetings with the U.S. chargé d'affaires, J. Bruce Amstutz, which, while never amounting to any agreement between Amin and the United States, sowed suspicion in the Kremlin .
Information obtained by the KGB from its agents in Kabul provided the last arguments to eliminate Amin. Supposedly, two of Amin's guards killed the former president Nur Muhammad Taraki with a pillow, and Amin, himself, was suspected to be a CIA agent. The latter, however, is still disputed with Amin repeatedly demonstrating friendliness toward the various delegates of the Soviet Union who would arrive in Afghanistan. Soviet General Vasily Zaplatin, a political advisor of Premier Brezhnev at the time, claimed that four of President Taraki's ministers were responsible for the destabilization. However, Zaplatin failed to emphasize this in discussions and was not heard. 
By the late 1970s, rapprochement between the USSR and the US had been well-established, which had led to growing tendencies toward détente and as such, attempts toward disarmament . Of note was the SALT I treaty, which was created to encourage cooperation in matters of nuclear weaponry and technology between the two nations. A second round of talks between Soviet premier Brezhnev and President Carter yielded the SALT II treaty in June 1979. (the United States Senate later failed to ratify the treaty due to the Soviet-Afghan conflict). Conservatives believe that this process was reflective of growing Soviet political influence in the world and that Soviet intervention in Afghanistan in December 1979 was an attempt to preserve, stabilize and militarily intervene on behalf of the communist regime there and thus, their own political standing.
During meetings between President Taraki and Soviet leaders in March 1979, the Soviets promised political support and to send military equipment and technical specialists, but upon repeated requests by Taraki for direct Soviet intervention, the leadership adamantly opposed him; reasons included that they would be met with "bitter resentment" from the Afghan people, that intervening in another country's civil war would hand a propaganda victory to their opponents, and Afghanistan's overall inconsequential weight in international affairs, in essence realizing they had little to gain by taking over a country with a poor economy, unstable government, and population hostile to outsiders. However, as the situation continued to deteriorate from May–December 1979, Moscow changed its mind on dispatching Soviet troops. The reasons for this complete turnabout are not entirely clear, and several speculative arguments include the grave internal situation and inability for the Afghan government, headed by Amin from 14 September 1979 after a successful coup, to quell the rebellion, the effects of the Iranian Revolution that brought an Islamic theocracy into power, leading to fears that religious fanaticism would spread through Afghanistan and into Soviet Muslim Central Asian republics, and the deteriorating ties with the United States with the failure of Congress to ratify the SALT II treaty and the impression that détente was "already effectively dead." 
Soviet intervention and coup
On October 31, 1979 Soviet informants to the Afghan Armed Forces who were under orders from the inner circle of advisors under Soviet premier Brezhnev, relayed information for them to undergo maintenance cycles for their tanks and other crucial equipment. Meanwhile, telecommunications links to areas outside of Kabul were severed, isolating the capital. With a deteriorating security situation, large numbers of Soviet Airborne Forces joined stationed ground troops and began to land in Kabul on December 25. Simultaneously, Amin moved the offices of the president to the Tajbeg Palace , believing this location to be more secure from possible threats. According to Colonel General Tukharinov and Merimsky, Amin was fully informed of the military movements, having requested Soviet military assistance to northern Afghanistan on December 17. His brother and General Dmitry Chiangov met with the commander of the 40th Army before Soviet troops entered the country, to work out initial routes and locations for Soviet troops.
On December 27, 1979, 700 Soviet troops dressed in Afghan uniforms, including KGB and GRU special forces officers from the Alpha Group and Zenith Group , occupied major governmental, military and media buildings in Kabul, including their primary target – the Tajbeg Presidential Palace .
That operation began at 19:00 hr., when the KGB-led Soviet Zenith Group destroyed Kabul's communications hub, paralyzing Afghan military command. At 19:15, the assault on Tajbeg Palace began; as planned, president Hafizullah Amin was killed. Simultaneously, other objectives were occupied (e.g., the Ministry of Interior at 19:15). The operation was fully complete by the morning of December 28, 1979.
The Soviet military command at Termez , Uzbek SSR , announced on Radio Kabul that Afghanistan had been liberated from Amin's rule. According to the Soviet Politburo they were complying with the 1978 Treaty of Friendship, Cooperation and Good Neighborliness and Amin had been "executed by a tribunal for his crimes" by the Afghan Revolutionary Central Committee. That committee then elected as head of government former Deputy Prime Minister Babrak Karmal , who had been demoted to the relatively insignificant post of ambassador to Czechoslovakia following the Khalq takeover, and announced that it had requested Soviet military assistance. 
Soviet ground forces, under the command of Marshal Sergei Sokolov , entered Afghanistan from the north on December 27. In the morning, the 103rd Guards 'Vitebsk' Airborne Division landed at the airport at Bagram and the deployment of Soviet troops in Afghanistan was underway. The force that entered Afghanistan, in addition to the 103rd Guards Airborne Division, was under command of the 40th Army and consisted of the 108th and 5th Guards Motor Rifle Divisions, the 860th Separate Motor Rifle Regiment, the 56th Separate Airborne Assault Brigade, the 36th Mixed Air Corps. Later on the 201st and 58th Motor Rifle Divisions also entered the country, along with other smaller units.  In all, the initial Soviet force was around 1,800 tanks , 80,000 soldiers and 2,000 AFVs . In the second week alone, Soviet aircraft had made a total of 4,000 flights into Kabul. With the arrival of the two later divisions, the total Soviet force rose to over 100,000 personnel.
International positions on Soviet intervention
Foreign ministers from 34 Islamic nations adopted a resolution which condemned the Soviet intervention and demanded "the immediate, urgent and unconditional withdrawal of Soviet troops" from the Muslim nation of Afghanistan.  The UN General Assembly passed a resolution protesting the Soviet intervention in Afghanistan by a vote of 104–18.  According to political scientist Gilles Kepel, the Soviet intervention or "invasion" was "viewed with horror" in the West, considered to be a "fresh twist" on the geo-political " Great Game " of the 19th Century in which Britain feared that Russia sought access to the Indian Ocean and posed "a threat to Western security", explicitly violating "the world balance of power agreed upon at Yalta " in 1945. 
Weapons supplies were made available through numerous countries; the United States purchased all of Israel's captured Soviet weapons clandestinely, and then funnelled the weapons to the Mujahideen, while Egypt upgraded their own army's weapons, and sent the older weapons to the militants, Turkey sold their World War II stockpiles to the warlords, and the British and Swiss provided Blowpipe missiles and Oerlikon anti-aircraft guns respectively, after they were found to be poor models for their own forces. China provided the most relevant weapons, likely due to their own experience with guerrilla warfare , and kept meticulous record of all the shipments.
December 1979 – February 1980: Occupation
The first phase began with the Soviet intervention in Afghanistan and their first battles with various opposition groups.  Soviet troops entered Afghanistan along two ground routes and one air corridor , quickly taking control of the major urban centers, military bases and strategic installations. However, the presence of Soviet troops did not have the desired effect of pacifying the country. On the contrary, it exacerbated a nationalistic feeling, causing the rebellion to spread further. Babrak Karmal, Afghanistan's new president, charged the Soviets with causing an increase in the unrest, and demanded that the 40th Army step in and quell the rebellion, as his own army had proved untrustworthy. Thus, Soviet troops found themselves drawn into fighting against urban uprisings, tribal armies (called lashkar ), and sometimes against mutinying Afghan Army units. These forces mostly fought in the open, and Soviet airpower and artillery made short work of them. 
March 1980 – April 1985: Soviet offensives
The war now developed into a new pattern: the Soviets occupied the cities and main axis of communication, while the mujahideen, (which the Soviet Army soldiers called 'Dushman,' meaning 'enemy') divided into small groups, waged a guerrilla war . Almost 80 percent of the country escaped government control. Soviet troops were deployed in strategic areas in the northeast, especially along the road from Termez to Kabul. In the west, a strong Soviet presence was maintained to counter Iranian influence. Incidentally, special Soviet units would have also performed secret attacks on Iranian territory to destroy suspected mujahideen bases, and their helicopters then got engaged in shootings with Iranian jets. Conversely, some regions such as Nuristan , in the northeast, and Hazarajat , in the central mountains of Afghanistan, were virtually untouched by the fighting, and lived in almost complete independence.
Periodically the Soviet Army undertook multi- divisional offensives into mujahideen-controlled areas. Between 1980 and 1985, nine offensives were launched into the strategically important Panjshir Valley , but government control of the area did not improve. Heavy fighting also occurred in the provinces neighbouring Pakistan, where cities and government outposts were constantly under siege by the mujahideen. Massive Soviet operations would regularly break these sieges, but the mujahideen would return as soon as the Soviets left. In the west and south, fighting was more sporadic, except in the cities of Herat and Kandahar , that were always partly controlled by the resistance.
The Soviets did not, at first, foresee taking on such an active role in fighting the rebels and attempted to play down their role there as giving light assistance to the Afghan army. However, the arrival of the Soviets had the opposite effect as it incensed instead of pacified the people, causing the mujahideen to gain in strength and numbers. Originally the Soviets thought that their forces would strengthen the backbone of the Afghan army and provide assistance by securing major cities, lines of communication and transportation. The Afghan army forces had a high desertion rate and were loath to fight, especially since the Soviet forces pushed them into infantry roles while they manned the armored vehicles and artillery. The main reason though that the Afghan soldiers were so ineffective was their lack of morale as many of them were not truly loyal to the communist government but simply collecting a paycheck. Once it became apparent that the Soviets would have to get their hands dirty, they followed three main strategies aimed at quelling the uprising. Intimidation was the first strategy, in which the Soviets would use airborne attacks as well as armored ground attacks to destroy villages, livestock and crops in trouble areas. The Soviets would bomb villages that were near sites of guerrilla attacks on Soviet convoys or known to support resistance groups. Local peoples were forced to either flee their homes or die as daily Soviet attacks made it impossible to live in these areas. By forcing the people of Afghanistan to flee their homes, the Soviets hoped to deprive the guerillas of resources and safe havens. The second strategy consisted of subversion which entailed sending spies to join resistance groups and report information as well as bribing local tribes or guerrilla leaders into ceasing operations. Finally, the Soviets used military forays into contested territories in an effort to root out the guerillas and limit their options. Classic search and destroy operations were implemented using Mil Mi-24 helicopter gunships that would provide cover for ground forces in armored vehicles. Once the villages were occupied by Soviet forces, inhabitants who remained were frequently interrogated and tortured for information or killed. 
To complement their brute force approach to weeding out the insurgency , the Soviets used KHAD (Afghan secret police) to gather intelligence, infiltrate the mujahideen, spread false information, bribe tribal militias into fighting and organize a government militia . While it is impossible to know exactly how successful the KHAD was in infiltrating mujahideen groups, it is thought that they succeeded in penetrating a good many resistance groups based in Afghanistan , Pakistan and Iran . KHAD is thought to have had particular success in igniting internal rivalries and political divisions amongst the resistance groups, rendering some of them completely useless because of infighting. The KHAD had some success in securing tribal loyalties but many of these relationships were fickle and temporary. Often KHAD secured neutrality agreements rather than committed political alignment. The Sarandoy , a KHAD controlled government militia, had mixed success in the war. Large salaries and proper weapons attracted a good number of recruits to the cause, even if they were not necessarily "pro-communist". The problem was that many of the recruits they attracted were in fact mujahideen who would join up to procure arms, ammunition and money while also gathering information about forthcoming military operations.
In 1985, the size of the LCOSF (Limited Contingent of Soviet Forces) was increased to 108,800 and fighting increased throughout the country, making 1985 the bloodiest year of the war. However, despite suffering heavily, the mujahideen were able to remain in the field, mostly because they received thousands of new volunteers daily, and continue resisting the Soviets.
In the mid-1980s, the Afghan resistance movement , assisted by the United States, Pakistan, Saudi Arabia, the United Kingdom, Egypt, the People's Republic of China and others, contributed to Moscow's high military costs and strained international relations. The U.S. viewed the conflict in Afghanistan as an integral Cold War struggle, and the CIA provided assistance to anti-Soviet forces through the Pakistani intelligence services , in a program called Operation Cyclone . 
Pakistan's North-West Frontier Province became a base for the Afghan resistance fighters and the Deobandi ulama of that province played a significant role in the Afghan 'jihad', with Madrasa Haqqaniyya becoming a prominent organisational and networking base for the anti-Soviet Afghan fighters. As well as money, Muslim countries provided thousands of volunteer fighters known as " Afghan Arabs ", who wished to wage jihad against the atheist communists. Notable among them was a young Saudi named Osama bin Laden , whose Arab group eventually evolved into al-Qaeda .   Despite their numbers,  the contribution has been called a "curious sideshow to the real fighting," with only an estimated 2000 of them fighting "at any one time", compared with about a 250,000 Afghan fighters and 125,000 Soviet troops. Their efforts were also sometimes counterproductive as in the March 1989 battle for Jalalabad. Instead of being the beginning of the collapse of the Afghan Communist government forces after their abandonment by the Soviets, the Afghan communists rallied to break the siege of Jalalabad and to win the first major government victory in years, provoked by the sight of a truck filled with dismembered bodies of Communists chopped to pieces after surrendering by radical non-Afghan salafists eager to show the enemy the fate awaiting the infidels. "This success reversed the government's demoralization from the withdrawal of Soviet forces, renewed its determination to fight on, and allowed it to survive three more years."
In the course of the guerrilla war, leadership came to be distinctively associated with the title of "commander". It applied to independent leaders, eschewing identification with elaborate military bureaucracy associated with such ranks as general. As the war produced leaders of reputation, "commander" was conferred on leaders of fighting units of all sizes, signifying pride in independence, self-sufficiency, and distinct ties to local communities. The title epitomized Afghan pride in their struggle against a powerful foe. Segmentation of power and religious leadership were the two values evoked by nomenclature generated in the war. Neither had been favored in the ideology of the former Afghan state.
Afghanistan's resistance movement was born in chaos, spread and triumphed chaotically, and did not find a way to govern differently. Virtually all of its war was waged locally by regional warlords . As warfare became more sophisticated, outside support and regional coordination grew. Even so, the basic units of mujahideen organization and action continued to reflect the highly segmented nature of Afghan society. 
Olivier Roy estimates that after four years of war, there were at least 4,000 bases from which mujahideen units operated. Most of these were affiliated with the seven expatriate parties headquartered in Pakistan, which served as sources of supply and varying degrees of supervision. Significant commanders typically led 300 or more men, controlled several bases and dominated a district or a sub-division of a province. Hierarchies of organization above the bases were attempted. Their operations varied greatly in scope, the most ambitious being achieved by Ahmad Shah Massoud of the Panjshir valley north of Kabul . He led at least 10,000 trained troopers at the end of the Soviet war and had expanded his political control of Tajik -dominated areas to Afghanistan's northeastern provinces under the Supervisory Council of the North. 
Roy also describes regional, ethnic and sectarian variations in mujahideen organization. In the Pashtun areas of the east, south and southwest, tribal structure, with its many rival sub-divisions, provided the basis for military organization and leadership. Mobilization could be readily linked to traditional fighting allegiances of the tribal lashkar (fighting force). In favorable circumstances such formations could quickly reach more than 10,000, as happened when large Soviet assaults were launched in the eastern provinces, or when the mujahideen besieged towns, such as Khost in Paktia province in July 1983. But in campaigns of the latter type the traditional explosions of manpower—customarily common immediately after the completion of harvest—proved obsolete when confronted by well dug-in defenders with modern weapons. Lashkar durability was notoriously short; few sieges succeeded. 
Mujahideen mobilization in non-Pashtun regions faced very different obstacles. Prior to the intervention, few non-Pashtuns possessed firearms. Early in the war they were most readily available from army troops or gendarmerie who defected or were ambushed. The international arms market and foreign military support tended to reach the minority areas last. In the northern regions, little military tradition had survived upon which to build an armed resistance. Mobilization mostly came from political leadership closely tied to Islam. Roy contrasts the social leadership of religious figures in the Persian - and Turkic -speaking regions of Afghanistan with that of the Pashtuns. Lacking a strong political representation in a state dominated by Pashtuns, minority communities commonly looked to pious learned or charismatically revered pirs (saints) for leadership. Extensive Sufi and maraboutic networks were spread through the minority communities, readily available as foundations for leadership, organization, communication and indoctrination. These networks also provided for political mobilization, which led to some of the most effective of the resistance operations during the war. 
The mujahideen favoured sabotage operations. The more common types of sabotage included damaging power lines , knocking out pipelines and radio stations, blowing up government office buildings , air terminals , hotels, cinemas, and so on. In the border region with Pakistan, the mujahideen would often launch 800 rockets per day. Between April 1985 and January 1987, they carried out over 23,500 shelling attacks on government targets. The mujahideen surveyed firing positions that they normally located near villages within the range of Soviet artillery posts, putting the villagers in danger of death from Soviet retaliation. The mujahideen used land mines heavily. Often, they would enlist the services of the local inhabitants, even children.
They concentrated on both civilian and military targets, knocking out bridges, closing major roads, attacking convoys , disrupting the electric power system and industrial production, and attacking police stations and Soviet military installations and air bases. They assassinated government officials and PDPA members, and laid siege to small rural outposts . In March 1982, a bomb exploded at the Ministry of Education, damaging several buildings. In the same month, a widespread power failure darkened Kabul when a pylon on the transmission line from the Naghlu power station was blown up. In June 1982 a column of about 1,000 young communist party members sent out to work in the Panjshir valley were ambushed within 30 km of Kabul, with heavy loss of life. On September 4, 1985, insurgents shot down a domestic Bakhtar Airlines plane as it took off from Kandahar airport, killing all 52 people aboard.
Mujahideen groups used for assassination had three to five men in each. After they received their mission to kill certain government officials, they busied themselves with studying his pattern of life and its details and then selecting the method of fulfilling their established mission. They practiced shooting at automobiles, shooting out of automobiles , laying mines in government accommodation or houses, using poison, and rigging explosive charges in transport.
In May 1985, the seven principal rebel organizations formed the Seven Party Mujahideen Alliance to coordinate their military operations against the Soviet army. Late in 1985, the groups were active in and around Kabul, unleashing rocket attacks and conducting operations against the communist government.
|“||Those hopelessly brave warriors I walked with, and their families, who suffered so much for faith and freedom and who are still not free, they were truly the people of God.||”|
|— Journalist Rob Schultheis , 1992.|
International journalistic perception of the war varied. Major American television journalists were sympathetic to the mujahideen. Most visible was CBS news correspondent Dan Rather who in 1982 accused the Soviets of "genocide," comparing them to Hitler.  Rather was embedded with the mujahideen for a 60 Minutes report.  In 1987, CBS produced a full documentary special on the war.  A retrospective commentary for Niemen Reports criticized mainstream television for biased presentation of a " Ramboesque struggle of holy warriors against the evil empire." 
Reader's Digest took a highly positive view of the mujahideen, a reversal of their usual view of Islamic fighters. The publication praised their martyrdom and their role in entrapping the Soviets in a Vietnam War-style disaster. 
At least some, such as leftist journalist Alexander Cockburn , were unsympathetic, criticizing Afghanistan as "an unspeakable country filled with unspeakable people, sheepshaggers and smugglers, who have furnished in their leisure hours some of the worst arts and crafts ever to penetrate the occidental world. I yield to none in my sympathy to those prostrate beneath the Russian jackboot, but if ever a country deserved rape it's Afghanistan."  Robert D. Kaplan on the other hand, thought any perception of mujahideen as "barbaric" was unfair: "Documented accounts of mujahidin savagery were relatively rare and involved enemy troops only. Their cruelty toward civilians was unheard of during the war, while Soviet cruelty toward civilians was common." Lack of interest in the mujahideen cause, Kaplan believed, was not the lack of intrinsic interest to be found in a war between a small, poor country and a superpower were a million civilians were killed, but the result of the great difficulty and unprofitability of media coverage. Kaplan note that "none of the American TV networks had a bureau for a war", and television cameramen venturing to follow the mujahideen "trekked for weeks on little food, only to return ill and half starved". In October 1984 the Soviet ambassador to Pakistan, Vitaly Smirnov, told Agence France Presse "that journalists traveling with the mujahidin 'will be killed. And our units in Afghanistan will help the Afghan forces to do it.'" Unlike Vietnam and Lebanon, Afghanistan had "absolutely no clash between the strange and the familiar", no "rock-video quality" of "zonked-out GIs in headbands" or "rifle-wielding Shiite terrorists wearing Michael Jackson T-shirts" that provided interesting "visual materials" for newscasts.
1986: Stinger Missile and "Stinger effect"
Whether the introduction of the personal, portable, infrared-homing surface-to-air " Stinger " missile in September 1986 was a turning point in the war is disputed. Many Western military analysts credit the Stinger with a kill ratio of about 70% and with responsibility for most of the over 350 Soviet or Afghan government aircraft and helicopters downed in the last two years of the war. Some military analysts considered it a "game changer" coined the term "Stinger effect" to describe it.  According to US Congressman Charlie Wilson who was instrumental in funding the Stingers for the Mujahideen, before the Stinger the Mujahideen never won a set piece battle with the Soviets but after it was introduced, the Mujahideen never again lost one.
However many Russian military analysts tend to be dismissive of the impact to the Stinger. According to Alan J. Kuperman, Soviet leader Mikhail Gorbachev decided to withdraw from Afghanistan a year before the mujahideen fired their first Stinger missiles, motivated by U.S. sanctions, not military losses. The stingers did make an impact at first but within a few months flares, beacons, and exhaust baffles were installed to disorient the missiles, along with night operation and terrain-hugging tactics to prevent the rebels from getting a clear shot. By 1988, Kuperman states, the mujahideen had all but stopped firing them.  Another source (Jonathan Steele) states that Stingers forced Soviet helicopters and ground attack planes to bomb from higher altitudes with less accuracy, but did not bring down many more aircraft than Chinese heavy machine guns and other less sophisticated antiaircraft weaponry. 
Diplomatic efforts and Geneva Accords (1983–88)
As early as 1983, Pakistan's Foreign ministry began working with the Soviet Union to provide them an exit from the Afghanistan , initiatives led by Foreign Minister Yaqub Ali Khan and Khurshid Kasuri . Despite an active support for insurgent groups , Pakistanis remained sympathetic to the challenges faced by the Russians in restoring the peace, eventually exploring the idea towards the possibility of setting-up the interim system of government under former monarch Zahir Shah but this was not authorized by President Zia-ul-Haq due to his stance on issue of Durand line . : 247–248  In 1984–85, Foreign Minister Yaqub Ali Khan paid state visits to China, Saudi Arabia , Soviet Union , France, United States and the United Kingdom in order to develop framework for the Geneva Accords which was signed in 1988 between Pakistan and Afghanistan. : 335 
April 1985 – January 1987: Exit strategy
The first step of the Soviet Union's exit strategy was to transfer the burden of fighting the mujahideen to the Afghan armed forces, with the aim of preparing them to operate without Soviet help. During this phase, the Soviet contingent was restricted to supporting the DRA forces by providing artillery , air support and technical assistance, though some large-scale operations were still carried out by Soviet troops.
Under Soviet guidance, the DRA armed forces were built up to an official strength of 302,000 in 1986. To minimize the risk of a coup d'état, they were divided into different branches, each modeled on its Soviet counterpart. The ministry of defence forces numbered 132,000, the ministry of interior 70,000 and the ministry of state security ( KHAD ) 80,000. However, these were theoretical figures: in reality each service was plagued with desertions , the army alone suffering 32,000 per year.
The decision to engage primarily Afghan forces was taken by the Soviets, but was resented by the PDPA, who viewed the departure of their protectors without enthusiasm. In May 1987 a DRA force attacked well-entrenched mujahideen positions in the Arghandab District , but the mujahideen held their ground, and the attackers suffered heavy casualties. In the spring of 1986, an offensive into Paktia Province briefly occupied the mujahideen base at Zhawar only at the cost of heavy losses.  Meanwhile, the mujahideen benefited from expanded foreign military support from the United States, Saudi Arabia, Pakistan and other Muslim nations. The US tended to favor the Afghan resistance forces led by Ahmed Shah Massoud , and US support for Massoud's forces increased considerably during the Reagan administration in what US military and intelligence forces called " Operation Cyclone ". Primary advocates for supporting Massoud included two Heritage Foundation foreign policy analysts, Michael Johns and James A. Phillips, both of whom championed Massoud as the Afghan resistance leader most worthy of US support under the Reagan Doctrine .   
January 1987 – February 1989: Withdrawal
The arrival of Mikhail Gorbachev on the scene in 1985 and his 'new thinking' on foreign and domestic policy was likely an important factor in the Soviets' decision to withdraw. Gorbachev had been attempting to remove the Soviet Union from the economic stagnation that had set in, under the leadership of Premier Brezhnev, and reform the Soviet Union's economy and image across the board with Glasnost and Perestroika . Gorbachev had also been attempting to ease cold war tensions by signing the Intermediate-Range Nuclear Forces Treaty in 1987 with the U.S. and withdrawing the troops from Afghanistan whose presence had garnered so much international condemnation. Gorbachev regarded confrontation with China and resulting military build ups on that border as one of Brezhnev's biggest mistakes. Beijing had stipulated that a normalization of relations would have to wait until Moscow withdrew its army from Afghanistan (among other things) and in 1989 the first Sino-Soviet summit in 30 years took place. At the same time, Gorbachev pressured his Cuban allies in Angola to scale down activities and withdraw even though Soviet allies were faring somewhat better there.  The Soviets also pulled many of their troops out of Mongolia in 1987 where they were also having a far easier time than in Afghanistan and restrained the Vietnamese invasion of Kampuchea to the point of an all out withdrawal in 1988.  This massive withdrawal of Soviet forces from such highly contested areas shows that the Soviet government's decision to leave Afghanistan was based upon a general change in Soviet foreign policy- from that of confrontation to avoidance of conflict wherever possible.
In the last phase, Soviet troops prepared and executed their withdrawal from Afghanistan, whilst limiting the launching of offensive operations by those who hadn't withdrawn yet.
By mid-1987 the Soviet Union announced that it would start withdrawing its forces. Sibghatullah Mojaddedi was selected as the head of the Interim Islamic State of Afghanistan, in an attempt to reassert its legitimacy against the Moscow-sponsored Kabul regime. Mojaddedi, as head of the Interim Afghan Government, met with then Vice President of the United States George H. W. Bush , achieving a critical diplomatic victory for the Afghan resistance. Defeat of the Kabul government was their solution for peace. This confidence, sharpened by their distrust of the United Nations, virtually guaranteed their refusal to accept a political compromise.
Operation Magistral , has been one of the final offensive operations undertaken by the Soviets; a successful sweep operation that cleared the road between Gardez and Khost . This operation did not have any lasting effect on the outcome of the conflict nor the soiled political and military status of the Soviets in the eyes of the West, but was a symbolic gesture that marked the end of their widely condemned presence in the country with a victory. 
The first half of the Soviet contingent was withdrawn from May 15 to August 16, 1988 and the second from November 15 to February 15, 1989. In order to ensure a safe passage the Soviets had negotiated ceasefires with local mujahideen commanders, so the withdrawal was generally executed peacefully,  except for the operation "Typhoon".
General Yazov, the Defense Minister of Soviet Union , ordered the 40th Army to violate the agreement with Ahmed Shah Masood , who commanded a large force in the Panjshir Valley, and attack his relaxed and exposed forces. The Soviet attack was initiated to protect Najibullah, who did not have a cease fire in effect with Masood, and who rightly feared an offensive by Masood's forces after the Soviet withdrawal.  General Gromov, the 40th Army Commander, objected to the operation, but reluctantly obeyed the order. "Typhoon" began on January 23 and continued for three days. To minimize their own losses the Soviets abstained from close-range fight, instead they used long-range artillery, surface-to-surface and air-to-surface missiles. Numerous civilian casualties were reported. Masood had not threatened the withdrawal to this point, and did not attack Soviet forces after they breached the agreement.  Overall, the Soviet attack represented a defeat for Masood's forces, who lost 600 fighters killed and wounded. 
After the withdrawal of the Soviets the DRA forces were left fighting alone and had to abandon some provincial capitals, and it was widely believed that they would not be able to resist the mujahideen for long. However, in the spring of 1989 DRA forces inflicted a sharp defeat on the mujahideen at Jalalabad .
The government of President Karmal, a puppet regime , was largely ineffective. It was weakened by divisions within the PDPA and the Parcham faction, and the regime's efforts to expand its base of support proved futile. Moscow came to regard Karmal as a failure and blamed him for the problems. Years later, when Karmal's inability to consolidate his government had become obvious, Mikhail Gorbachev, then General Secretary of the Soviet Communist Party , said:
"The main reason that there has been no national consolidation so far is that Comrade Karmal is hoping to continue sitting in Kabul with our help".
In November 1986, Mohammad Najibullah , former chief of the Afghan secret police ( KHAD ), was elected president and a new constitution was adopted. He also introduced in 1987 a policy of "national reconciliation," devised by experts of the Communist Party of the Soviet Union , and later used in other regions of the world. Despite high expectations, the new policy neither made the Moscow-backed Kabul regime more popular, nor did it convince the insurgents to negotiate with the ruling government.
Informal negotiations for a Soviet withdrawal from Afghanistan had been underway since 1982. In 1988, the governments of Pakistan and Afghanistan, with the United States and Soviet Union serving as guarantors, signed an agreement settling the major differences between them known as the Geneva Accords . The United Nations set up a special Mission to oversee the process. In this way, Najibullah had stabilized his political position enough to begin matching Moscow's moves toward withdrawal. On July 20, 1987, the withdrawal of Soviet troops from the country was announced. The withdrawal of Soviet forces was planned out by Lt. Gen. Boris Gromov , who, at the time, was the commander of the 40th Army .
Among other things the Geneva accords identified the US and Soviet non-intervention in the internal affairs of Pakistan and Afghanistan and a timetable for full Soviet withdrawal. The agreement on withdrawal held, and on February 15, 1989, the last Soviet troops departed on schedule from Afghanistan.
American professor Samuel Totten ,  Australian professor Paul R. Bartrop ,  scholars from Yale Law School such as W. Michael Reisman  and Charles Norchi,  as well as scholar Mohammed Kakar, believe that the Afghans were victims of genocide by the Soviet Union.  The army of the Soviet Union killed large numbers of Afghans to suppress their resistance.  The Soviet forces and their proxies deliberately targeted civilians, particularly in rural areas. Up to 2 million Afghans lost their lives during the Soviet occupation.  
In one notable incident the Soviet Army committed mass killing of civilians in the summer of 1980.  In order to separate the mujahideen from the local populations and eliminate their support, the Soviet army killed and drove off civilians, and used scorched earth tactics to prevent their return. They used booby traps, mines, and chemical substances throughout the country.  The Soviet army indescriminately killed combatants and noncombatants to ensure submission by the local populations.  The provinces of Nangarhar, Ghazni, Lagham, Kunar, Zabul, Qandahar, Badakhshan, Lowgar, Paktia and Paktika witnessed extensive depopulation programmes by the Soviet forces.
The Soviet forces abducted Afghan women in helicopters while flying in the country in search of mujahideen. In November 1980 a number of such incidents had taken place in various parts of the country, including Laghman and Kama. Soviet soldiers as well as KhAD agents kidnapped young women from the city of Kabul and the areas of Darul Aman and Khair Khana, near the Soviet garrisons, to rape them.  Women who were taken and raped by Russian soldiers were considered 'dishonoured' by their families if they returned home.  Deserters from the Soviet Army in 1984 also confirmed the atrocities by the Soviet troops on Afghan women and children, stating that Afghan women were being raped. 
President Jimmy Carter placed a trade embargo against the Soviet Union on shipments of commodities such as grain. This resulted in newly increased tensions between the two nations. On top of recently sparked apprehensions in the West directed toward the tens of thousands of Soviet troops which were of close proximity to oil-rich regions in the Persian Gulf , the Soviet invasion of Afghanistan effectively brought about the end of détente .
The international diplomatic response was severe, ranging from stern warnings from the UN to a US-led boycott of the 1980 Summer Olympics in Moscow (in which Afghanistan competed). The intervention, along with other events, such as the Iranian revolution and the US hostage stand-off that accompanied it, the Iran–Iraq War , the 1982 Lebanon War and the escalating tensions between Pakistan and India, contributed to the volatility of the Middle East and South Asian regions in the 1980s.
The Non-Aligned Movement was sharply divided between those who believed the Soviet deployment to be a legitimate police action and others who considered the deployment an illegal invasion. Among the Warsaw Pact countries, the intervention was condemned only by Romania .  India, a close ally of the Soviet Union, refused to support the Afghan war,  though by the end of the hostilities, offered to provide humanitarian assistance to the Afghan government. 
Foreign involvement and aid to the mujahideen
The Afghan Mujahideen were supported by several other countries, with the U.S. and Saudi Arabia offering the greatest financial support.     The first shipment of U.S.weapons intended for the mujahideen reached Pakistan on January 10, 1980, shortly following the Soviet invasion.  United States President Carter insisted that what he termed "Soviet aggression" could not be viewed as an isolated event of limited geographical importance but had to be contested as a potential threat to US influence in the Persian Gulf region. The US was also worried about the USSR gaining access to the Indian Ocean by coming to an arrangement with Pakistan. (The Soviet air base outside of Kandahar was "30 minutes flying time by strike aircraft or naval bomber" to the Persian Gulf according to Robert Kaplan. It "became the heart of the southernmost concentration of Soviet soldier" in the 300-year history of Russian expansion in central Asia.)
National Security Advisor Zbigniew Brzezinski , known for his hardline policies on the Soviet Union, initiated in 1979 a campaign supporting mujahideen in Pakistan and Afghanistan , which was run by Pakistani security services with financial support from the Central Intelligence Agency and Britain's MI6 .  Years later, in a 1997 CNN / National Security Archive interview, Brzezinski detailed the strategy taken by the Carter administration against the Soviets in 1979:
We immediately launched a twofold process when we heard that the Soviets had entered Afghanistan. The first involved direct reactions and sanctions focused on the Soviet Union, and both the State Department and the National Security Council prepared long lists of sanctions to be adopted, of steps to be taken to increase the international costs to the Soviet Union of their actions. And the second course of action led to my going to Pakistan a month or so after the Soviet invasion of Afghanistan, for the purpose of coordinating with the Pakistanis a joint response, the purpose of which would be to make the Soviets bleed for as much and as long as is possible; and we engaged in that effort in a collaborative sense with the Saudis , the Egyptians, the British, the Chinese, and we started providing weapons to the Mujaheddin, from various sources again – for example, some Soviet arms from the Egyptians and the Chinese. We even got Soviet arms from the Czechoslovak communist government, since it was obviously susceptible to material incentives; and at some point we started buying arms for the Mujaheddin from the Soviet army in Afghanistan, because that army was increasingly corrupt. 
The supplying of billions of dollars in arms to the Afghan mujahideen militants was one of the CIA's longest and most expensive covert operations.  The CIA provided assistance to the fundamentalist insurgents through the Pakistani secret services, Inter-Services Intelligence (ISI), in a program called Operation Cyclone . At least 3 billion in U.S. dollars were funneled into the country to train and equip troops with weapons. Together with similar programs by Saudi Arabia, Britain's MI6 and SAS , Egypt, Iran, and the People's Republic of China,  the arms included FIM-43 Redeye , shoulder-fired, antiaircraft weapons that they used against Soviet helicopters. Pakistan's secret service, Inter-Services Intelligence (ISI), was used as an intermediary for most of these activities to disguise the sources of support for the resistance.
Although some sources have claimed that no Americans had direct contact with the mujahideen,   there was recurrent contact between the CIA and Afghan commanders, especially by agent Howard Hart ,  and Director of Central Intelligence William Casey personally visited training camps on several occasions.   There was also direct Pentagon and State Department involvement   which led to several major mujahideen being welcomed to the White House for a conference in October 1985. Gulbuddin Hekmatyar declined the opportunity to meet with Ronald Reagan, but Yunus Khalis and Abdul Haq were hosted by the president.    CIA agents are also known to have given direct cash payments to Jalaluddin Haqqani . 
Shortly after the intervention, Pakistan's military ruler General Muhammad Zia-ul-Haq called for a meeting of senior military members and technocrats of his military government .  At this meeting, General Zia-ul-Haq asked the Chief of Army Staff General Khalid Mahmud Arif and the Chairman of the Joint Chiefs of Staff Admiral Muhammad Shariff to lead a specialized civil-military team to formulate a geo-strategy to counter the Soviet aggression.  At this meeting, the Director-General of the ISI at that time, Lieutenant-General Akhtar Abdur Rahman advocated for an idea of covert operation in Afghanistan by arming the Islamic extremist, and was loudly heard saying: " Kabul must burn! Kabul must burn! ".  As for Pakistan, the Soviet war with Islamist mujahideen was viewed as retaliation for the Soviet Union's long unconditional support of regional rival, India, notably during the 1965 and the 1971 wars , which led to the loss of East Pakistan . 
After the Soviet deployment, Pakistan's military ruler General Muhammad Zia-ul-Haq started accepting financial aid from the Western powers to aid the mujahideen.  In 1981, following the election of US President Ronald Reagan , aid for the mujahideen through Zia's Pakistan significantly increased, mostly due to the efforts of Texas Congressman Charlie Wilson and CIA officer Gust Avrakotos .  
Pakistan's ISI and Special Service Group (SSG) were actively involved in the conflict. The SSG are widely suspected of participating in Operation Hill 3234 , near the Pakistani border where nearly 200 suspected SSG personnel were killed in a futile attempt to assault the Soviet held hill.
The theft of large sums of aid spurred Pakistan's economic growth, but along with the war in general had devastating side effects for that country. The siphoning off of aid weapons, in which the weapons logistics and coordination were put under the Pakistan Navy in the port city of Karachi , contributed to disorder and violence there, while heroin entering from Afghanistan to pay for arms contributed to addiction problems. The Navy went into covert war and coordinated the foreign weapons into Afghanistan, while some of its high-ranking admirals were responsible for storing the weapons in the Navy depot, later coordinated the weapons supply to mujahideen.
In retaliation for Pakistan's assistance to the insurgents, the KHAD Afghan security service, under leader Mohammad Najibullah , carried out (according to the Mitrokhin Archives and other sources) a large number of operations against Pakistan. In 1987, 127 incidents resulted in 234 deaths in Pakistan. In April 1988, an ammunition depot outside the Pakistani capital of Islamabad was blown up killing 100 and injuring more than 1000 people. The KHAD and KGB were suspected in the perpetration of these acts. Soviet and Afghan fighters and bombers occasionally bombed Pakistani villages along the Pakistani-Afghan border. These attacks are known to have caused at least 300 civilian deaths and extensive damage. Sometimes they got involved in shootings with the Pakistani jets defending the airspace.
Pakistan took in millions of Afghan refugees (mostly Pashtun) fleeing the Soviet occupation. Although the refugees were controlled within Pakistan's largest province, Balochistan under then- martial law ruler General Rahimuddin Khan , the influx of so many refugees – believed to be the largest refugee population in the world  – spread into several other regions.
All of this had a heavy impact on Pakistan and its effects continue to this day. Pakistan, through its support for the mujahideen, played a significant role in the eventual withdrawal of Soviet military personnel from Afghanistan.
During the Sino-Soviet split , strained relations between China and the USSR resulted in bloody border clashes and mutual backing for the opponent's enemies. China and Afghanistan had neutral relations with each other during the King's rule. When the pro-Soviet Afghan Communists seized power in Afghanistan in 1978, relations between China and the Afghan communists quickly turned hostile. The Afghan pro-Soviet communists supported China's then-enemy Vietnam and blamed China for supporting Afghan anticommunist militants. China responded to the Soviet war in Afghanistan by supporting the Afghan mujahideen and ramping up their military presence near Afghanistan in Xinjiang. China acquired military equipment from America to defend itself from Soviet attack. 
The Chinese People's Liberation Army trained and supported the Afghan mujahideen during the war. The training camps were moved from Pakistan into China itself. Anti-aircraft missiles, rocket launchers and machine guns, valued at hundreds of millions, were given to the mujahideen by the Chinese. Chinese military advisors and army troops were present with the Mujahidin during training. 
Soviet personnel strengths and casualties
Between December 25, 1979, and February 15, 1989, a total of 620,000 soldiers served with the forces in Afghanistan (though there were only 80,000–104,000 serving at one time): 525,000 in the Army, 90,000 with border troops and other KGB sub-units, 5,000 in independent formations of MVD Internal Troops , and police forces. A further 21,000 personnel were with the Soviet troop contingent over the same period doing various white collar and blue collar jobs.
The total irrecoverable personnel losses of the Soviet Armed Forces, frontier, and internal security troops came to 14,453. Soviet Army formations, units, and HQ elements lost 13,833, KGB sub-units lost 572, MVD formations lost 28, and other ministries and departments lost 20 men. During this period 312 servicemen were missing in action or taken prisoner; 119 were later freed, of whom 97 returned to the USSR and 22 went to other countries.
Of the troops deployed, 53,753 were wounded, injured, or sustained concussion and 415,932 fell sick. A high proportion of casualties were those who fell ill. This was because of local climatic and sanitary conditions, which were such that acute infections spread rapidly among the troops. There were 115,308 cases of infectious hepatitis , 31,080 of typhoid fever, and 140,665 of other diseases. Of the 11,654 who were discharged from the army after being wounded, maimed, or contracting serious diseases, 10,751 men, were left disabled.
Material losses were as follows: 
- 451 aircraft (includes 333 helicopters )
- 147 tanks
- 1,314 IFV / APCs
- 433 artillery guns and mortars
- 11,369 cargo and fuel tanker trucks.
Use of chemical weapons
There have also been numerous reports of chemical weapons being used by Soviet forces in Afghanistan, often indiscriminately against civilians.    A declassified CIA report from 1982 states that between 1979 and 1982 there were 43 separate chemical weapons attacks which caused more than 3000 deaths.  By early 1980, attacks with chemical weapons were reported in "all areas with concentrated resistance activity". 
Causes of withdrawal
Some of the causes of the Soviet Union's withdrawal from Afghanistan leading to the Afghanistan regime's eventual defeat include 
- The Soviet Army of 1980 was trained and equipped for large scale, conventional warfare in Central Europe against a similar opponent, i.e. it used armored and motor-rifle formations. This was notably ineffective against small scale guerrilla groups using hit-and-run tactics in the rough terrain of Afghanistan. The large Red Army formations weren't mobile enough to engage small groups of Muj fighters that easily merged back into the terrain.  The set strategy also meant that troops were discouraged from "tactical initiative", essential in counter insurgency, because it "tended to upset operational timing". 
- The Russians used large scale offensives against Mujahideen strongholds, such as in the Panjshir Valley, which temporarily clearing those sectors and killed many civilians in addition to enemy combatants. The biggest shortcoming here was the fact that once the Russians did engage the enemy in force, they failed to hold the ground by withdrawing once their operation was completed. The killing of civilians further alienated the population from the Soviets, with bad long-term effects. 
- The Soviets didn't have enough men to fight a counter-insurgency war (COIN),  and their troops were not motivated. The peak number of Soviet troops during the war was 115,000. The bulk of these troops were conscripts, which led to poor combat performance in their Motor-Rifle Formations. However, the Russians did have their elite infantry units, such as the famed Spetsnaz, the VDV, and their recon infantry. The problem with their elite units was not combat effectiveness, but the fact that there were not enough of them and that they were employed incorrectly. 
- Intelligence gathering, essential for successful COIN, was inadequate. The Soviets over-relied on less-than-accurate aerial recon and radio intercepts rather than their recon infantry and special forces. Although their special forces and recon infantry units performed very well in combat against the Mujahideen, they would have better served in intelligence gathering. 
- The concept of a "war of national liberation" against a Soviet-sponsored "revolutionary" regime was so alien to the Soviet dogma, the leadership could not "come to grips" with it. This led to, among other things, a suppression by the Soviet media for several years of the truth how bad the war was going, which caused a backlash when it was unable to hide it further. 
Destruction in Afghanistan
Civilian death and destruction from the war was considerable. Estimates of Afghan civilian deaths vary from 562,000  to 2,000,000.    5–10 million Afghans fled to Pakistan and Iran, 1/3 of the prewar population of the country, and another 2 million were displaced within the country. In the 1980s, half of all refugees in the world were Afghan.
Felix Ermacora , the UN Special Rapporteur to Afghanistan, said that heavy fighting in combat areas cost the lives of more than 35,000 civilians in 1985, 15,000 in 1986, and around 14,000 in 1987. R.J. Rummel , an analyst of political killings, estimated that Soviet forces were responsible for 250,000 democidal killings during the war and that the government of Afghanistan was responsible for 178,000 democidal killings.  There were also a number of reports of large scale executions of hundreds of civilians by Soviet and DRA soldiers.    Noor Ahmed Khalidi calculated that 876,825 Afghans were killed during the Soviet invasion.  Martin Ewan and Marek Sliwinski estimated the number of war deaths to be much higher, at 1.25 million.  However, Siddieq Noorzoy presents an even higher figure of 1.71 million deaths during the Soviet-Afghan war.   Anti-government forces were also responsible for some casualties. Rocket attacks on Kabul's residential areas caused more than 4000 civilian deaths in 1987 according to the UN's Ermacora. 
Along with fatalities were 1.2 million Afghans disabled (mujahideen, government soldiers and noncombatants) and 3 million maimed or wounded (primarily noncombatants). 
Irrigation systems, crucial to agriculture in Afghanistan's arid climate , were destroyed by aerial bombing and strafing by Soviet or government forces. In the worst year of the war, 1985, well over half of all the farmers who remained in Afghanistan had their fields bombed, and over one quarter had their irrigation systems destroyed and their livestock shot by Soviet or government troops, according to a survey conducted by Swedish relief experts
The population of Afghanistan's second largest city, Kandahar, was reduced from 200,000 before the war to no more than 25,000 inhabitants, following a months-long campaign of carpet bombing and bulldozing by the Soviets and Afghan communist soldiers in 1987. Land mines had killed 25,000 Afghans during the war and another 10–15 million land mines, most planted by Soviet and government forces, were left scattered throughout the countryside.  The International Committee of the Red Cross estimated in 1994 that it would take 4,300 years to remove all the Soviet land mines in Afghanistan. 
A great deal of damage was done to the civilian children population by land mines.  A 2005 report estimated 3–4% of the Afghan population were disabled due to Soviet and government land mines. In the city of Quetta , a survey of refugee women and children taken shortly after the Soviet withdrawal found child mortality at 31%, and over 80% of the children refugees to be unregistered. Of children who survived, 67% were severely malnourished, with malnutrition increasing with age. 
Critics of Soviet and Afghan government forces describe their effect on Afghan culture as working in three stages: first, the center of customary Afghan culture, Islam, was pushed aside; second, Soviet patterns of life, especially amongst the young, were imported; third, shared Afghan cultural characteristics were destroyed by the emphasis on so-called nationalities, with the outcome that the country was split into different ethnic groups, with no language, religion, or culture in common. 
The Geneva Accords of 1988, which ultimately led to the withdrawal of the Soviet forces in early 1989, left the Afghan government in ruins. The accords had failed to address adequately the issue of the post-occupation period and the future governance of Afghanistan. The assumption among most Western diplomats was that the Soviet-backed government in Kabul would soon collapse; however, this was not to happen for another three years. During this time the Interim Islamic Government of Afghanistan (IIGA) was established in exile. The exclusion of key groups such as refugees and Shias , combined with major disagreements between the different mujahideen factions, meant that the IIGA never succeeded in acting as a functional government. 
Before the war, Afghanistan was already one of the world's poorest nations. The prolonged conflict left Afghanistan ranked 170 out of 174 in the UNDP's Human Development Index , making Afghanistan one of the least developed countries in the world. 
Once the Soviets withdrew, US interest in Afghanistan slowly decreased over the following four years, much of it administered through the DoD Office of Humanitarian Assistance, under the then Director of HA, George M. Dykes III. With the first years of the Clinton Administration in Washington, DC, all aid ceased. The US decided not to help with reconstruction of the country, instead handing the interests of the country over to US allies Saudi Arabia and Pakistan. Pakistan quickly took advantage of this opportunity and forged relations with warlords and later the Taliban , to secure trade interests and routes. The ten years following the war saw much ecological and agrarian destruction—from wiping out the country's trees through logging practices, which has destroyed all but 2% of forest cover country-wide, to substantial uprooting of wild pistachio trees for the exportation of their roots for therapeutic uses, to opium agriculture. 
Captain Tarlan Eyvazov, a soldier in the Soviet forces during the war, stated that the Afghan children's future is destined for war. Eyvazov said, "Children born in Afghanistan at the start of the war... have been brought up in war conditions, this is their way of life." Eyvazov's theory was later strengthened when the Taliban movement developed and formed from orphans or refugee children who were forced by the Soviets to flee their homes and relocate their lives in Pakistan. The swift rise to power, from the young Taliban in 1996, was the result of the disorder and civil war that had warlords running wild because of the complete breakdown of law and order in Afghanistan after the departure of the Soviets.  
5.5 million Afghans were made refugees by the war—a full one third of the country's pre-war population—fleeing the country to Pakistan or Iran.
A total of 3.3 million Afghan refugees were housed in Pakistan by 1988, some of whom continue to live in the country up until today. Of this total, about 100,000 were based in the city of Peshawar , while more than 2 million were located in other parts of the northwestern province of Khyber Pakhtunkhwa (then known as the North-West Frontier Province).   At the same time, close to two million Afghans were living in Iran . Over the years Pakistan and Iran have imposed tighter controls on refugees which have resulted in numerous returnees.   In 2012 Pakistan banned extensions of visas to foreigners.   Afghan refugees have also settled in India and became Indian citizens over time.    Some also made their way into North America, the European Union , Australia, and other parts of the world.  The photo of Sharbat Gula placed on National Geographic cover in 1985 became a symbol both of the 1980s Afghan conflict and of the refugee situation.
Weakening of the Soviet Union
According to scholars Rafael Reuveny and Aseem Prakash, the war contributed to the fall of the Soviet Union by undermining the image of the Red Army as invincible, undermining Soviet legitimacy, and by creating new forms of political participation.
The war created a cleavage between the party and the military in the Soviet Union where the efficacy of using the Soviet military to maintain the USSR's overseas interests was now put in doubt. In the non-Russian republics, those interested in independence were emboldened by the army's defeat. In Russia the war created cleavage between the party and the military, changing the perceptions of leaders about the ability to put down anti-Soviet resistance militarily (as it had in Czechoslovakia in 1968 , Hungary in 1956 , and East Germany in 1953 ). As the war was viewed as "a Russian war fought by non Russians against Afghans", outside of Russia it undermined the legitimacy of the Soviet Union as a trans-national political union. The war created new forms of political participation, in the form of new civil organizations of war veterans (Afghansti) which weakened the political hegemony of the communist party. It also started the transformation of the press/media which continued under glasnost . 
The war did not end with the withdrawal of the Soviet Army. The Soviet Union left Afghanistan deep in winter, with intimations of panic among Kabul officials. The Afghan mujahideen were poised to attack provincial towns and cities and eventually Kabul, if necessary. Najibullah's government, though failing to win popular support, territory, or international recognition, was able to remain in power until 1992.
Civil war between the Afghan army and mujahideen continued and about 400,000 Afghan civilians had lost their lives in the chaos and civil war of the 1990s.  Ironically, until demoralized by the defections of its senior officers, the Afghan Army had achieved a level of performance it had never reached under direct Soviet tutelage. Kabul had achieved a stalemate that exposed the mujahideen's weaknesses, political and military. But for nearly three years, while Najibullah's government successfully defended itself against mujahideen attacks, factions within the government had also developed connections with its opponents.
According to Russian publicist Andrey Karaulov, the main trigger for Najibullah losing power was Russia's refusal to sell oil products to Afghanistan in 1992 for political reasons (the new Yeltsin government did not want to support the former communists), which effectively triggered an embargo. The defection of General Abdul Rashid Dostam and his Uzbek militia , in March 1992, further undermined Najibullah's control of the state. In April, Najibullah and his communist government fell to the mujahideen, who replaced Najibullah with a new governing council for the country.
Grain production declined an average of 3.5% per year between 1978 and 1990 due to sustained fighting, instability in rural areas, prolonged drought, and deteriorated infrastructure. Soviet efforts to disrupt production in rebel-dominated areas also contributed to this decline. During the withdrawal of Soviet troops, Afghanistan's natural gas fields were capped to prevent sabotage. Restoration of gas production has been hampered by internal strife and the disruption of traditional trading relationships following the dissolution of the Soviet Union .
Extremism and "blowback"
Following the Soviet withdrawal, some of the foreign volunteers (including Osama bin Laden 's Al Qaeda )  and young Afghan refugees, went on to continue violent jihad in Afghanistan, Pakistan and abroad. Some of the thousands of Afghan Arabs who left Afghanistan went on to become "capable leaders, religious ideologues and military commanders," who played "vital roles" as insurgents or terrorists in places such as Algeria , Egypt, Bosnia and Chechnya .  Tens of thousands of Afghan refugee children in Pakistan were educated in madrasses "in a spirit of conservatism and religious rigor", and went on to fill the ranks and leadership of the Taliban in Afghanistan and Sipah-e-Sahaba in Pakistan. The groups embodied new varieties of Political Islam – " Salafi jihadism " among the foreign volunteers,  and a "hybrid" Deobandi jihadism among the madrassa-educated.
As many as 35,000 non-Afghan Muslim fighters went to Afghanistan between 1982 and 1992. Thousands more came and did not fight but attended schools with "former and future fighters". These "Afghan-Arabs" had a marginal impact on the jihad against the Soviets, but a much greater effect after the Soviets left and in other countries. (After the Soviets left, training continued and "tens of thousands" from "some 40 nations" came to prepare for armed insurrections "to bring the struggle back home". )
The man instrumental not only in generating international support but also in inspiring these volunteers to travel to Afghanistan for the jihad was a Palestinian Muslim Brotherhood cleric, Abdullah Azzam . Touring the Muslim world and the United States, he inspired young Muslims with stories of miraculous deeds, such as mujahideen who defeated vast columns of Soviet troops virtually single-handedly, angels riding into battle on horseback, and falling bombs intercepted by birds. 
When back in the volunteer camps and training centers that he helped set up around Peshawar, Pakistan, Azzam exercised a "strong influence." He preached the importance of jihad: "those who believe that Islam can flourish [and] be victorious without Jihad, fighting, and blood are deluded and have no understanding of the nature of this religion";  of not compromising: "Jihad and the rifle alone: no negotiations, no conferences and no dialogues";  and that Afghanistan was only the beginning: jihad would "remain an individual obligation" for Muslims until all other formerly-Muslim lands—" Palestine , Bukhara , Lebanon , Chad , Eritrea , Somalia , the Philippines , Burma , South Yemen , Tashkent , Andalusia "—were reconquered.
The volunteers also influenced each other. Many "unexpected" religious-political ideas resulted from the "cross-pollination" during the "great gathering" of Islamists from dozens of countries in the camps and training centers.  One in particular was a "variant of Islamist ideology based on armed struggle and extreme religious vigour", known as Salafi jihadism .
When the Soviet Union fell shortly after their withdrawal from Afghanistan, the volunteers were "exultant", believing that—in the words of Osama bin Laden —the credit for "the dissolution of the Soviet Union ... goes to God and the mujahideen in Afghanistan ... the US had no mentionable role,"  (Soviet economic troubles and United States aid to mujahideen notwithstanding). They eagerly sought to duplicate their jihad in other countries.
Three such countries were Bosnia , Algeria and Egypt . In Bosnia the Salafi jihadist Afghan Arabs fought against Bosnian Serb and Croat militias but failed to establish a Salafi state. In Algeria and Egypt thousand of volunteers returned and fought but were even less successful.  In Algeria Salafi jihadist helped lead and fight for the GIA , deliberately killing thousands of civilians.  In Egypt the Al-Gama'a al-Islamiyya killed more than a thousand people between 1990 and 1997 but also failed to overthrow the government. 
- Spread of extremism in Pakistan
Among the approximately three million Afghan refugees in Pakistan, thousands of children were educated in madrasa boarding schools financed by aid from the US and Gulf monarchies. Since that aid was distributed according to the conservative Islamist ideological criteria of Pakistan's President Muhammad Zia-ul-Haq and Saudi Arabia (and ignoring native Afghan traditions), the schools were part of networks of the favored Hizb-e-Islami party and the Pakistan Deobandi .  (Iran provided similar help to Shia Islamist groups and punishments to moderate Shia nationalist Afghans.)
Cut off from families and local traditions, the madrassa students were "educated to put Deobandi doctrines into action through obedience to the fatwas produced in the madrasses in a spirit of conservatism and religious rigor." As the Afghans students came of age, they formed "the mainstay" of the Taliban in Afghanistan and of the anti-Shia Sipah-e-Sahaba Sunni terror group in Pakistan. But unlike the traditionally non-violent Deobandi, this "hybrid movement" embraced the violence of jihad, and unlike the Islamists of Hizb-e-Islami they were uninterested in "islamizing modernity" of western knowledge or in western knowledge at all. The culture of religious purification, absolute obedience to leaders, and disinterest in anything else, is thought to explain the willingness of Hizb-e-Islami -trained soldiers to bombard Kabul with artillery and kill thousands of civilians, reassured by their commander that the civilians they killed would "be rewarded" in heaven if they were "good Muslims". From 2008 to 2014 "thousands of Shia" have been killed by Sunni extremists according to Human Rights Watch .
Blowback , or unintended consequences of funding the mujahideen, was said to have come to the United States in the 1993 World Trade Center bombing and the September 11 attacks .  In the 1993 bombing, all of the participants in the bombing "either had served in Afghanistan or were linked to a Brooklyn-based fund-raising organ for the Afghan jihad" that was later "revealed to be al Qaeda 's de facto U.S. headquarters".  Principals in the 2001 attack—Osama Bin Laden, Khalid Sheikh Mohammed  — had both fought in Afghanistan, and bin Laden was a lieutenant of Abdullah Azzam. His group Al Qaeda, returned to Afghanistan to take refuge with the Taliban after being expelled from Sudan.  Before the 9/11 attack, Al Qaeda had bombed two U.S. embassies in Africa in 1998, and nearly sank the U.S.S. Cole in Yemen in 2000.  However, no direct U.S. aid to bin Laden or any of his affiliates has ever been established.
Media and popular culture
Perception in the former USSR
Commemorating the intervention of December 25, 1979, in December 2009, veterans of the Soviet war in Afghanistan were honoured by the Duma or Parliament of the Russian Federation. On December 25, the lower house of the parliament defended the Soviet war in Afghanistan on the 30th anniversary of its start, and praised the veterans of the conflict. Differing assessments of the war "mustn't erode the Russian people's respect for the soldiers who honestly fulfilled their duty in implementing tasks to combat international terrorism and religious extremists". 
Duma member Semyon Bagdasarov ( Just Russia ) advocated that Russia had to reject Western calls for stronger assistance to the US-led ISAF -coalition in Afghanistan and also had to establish contacts with the "anti-Western forces"; the Taliban , in case they regain power.  
- Soviet occupation zone
- Dissolution of the Soviet Union
- Military of Afghanistan
- Spetsnaz (Russian Special Purpose Regiments)
- Post–World War II air-to-air combat losses
- Terrorism and the Soviet Union
- Soviet involvement in Indo-Pakistan war of 1971
- War in Afghanistan (1978–present)
- Political philosophies and doctrines