The Soviet–Afghan War lasted over nine years from December 1979 to February 1989. Insurgent groups (""the Mujahideen"") who received substantial aid from the United States and several Muslim countries, fought against the Soviet Army and allied Afghan forces. Between 850,000–1.5 million 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 pro-Soviet Nur Mohammad Taraki government took power in a 1978 coup and initiated a series of radical modernization reforms throughout the country. Vigorously suppressing any opposition from among the traditional Muslim Afghans, the government arrested thousands and executed as many of 27,000 political prisoners. By April 1979 large parts of the country were in open rebellion and by December the government had lost control of territory outside of the cities. In response to Afghan government requests, the Soviet government under leader Leonid Brezhnev first sent covert troops to advise and support the Afghani government, but on December 24, 1979, began the first deployment of the 40th Army. Arriving in the capital Kabul, they staged a coup, killing the Afghan President, and installing a rival Afghan socialist (Babrak Karmal).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, military training in neighboring Pakistan and China, paid for primarily by the United States and Arab monarchies in the Persian Gulf.Soviet troops occupied the cities and main axis of communication, while the mujahideen waged guerrilla war in small groups. Almost 80 percent of the country escaped government and Soviet control, but Soviets destroyed vital irrigation ditches and laid 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.The war was considered part of the Cold War. 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 thought to be a contributing factor to the fall of the Soviet Union.