The Soviet–Afghan War was a conflict wherein insurgent groups (known collectively as the Mujahideen), as well as smaller Maoist groups, fought a nine-year guerrilla war against the Soviet Army and the Democratic Republic of Afghanistan government throughout the 1980s, mostly in the Afghan countryside. The Mujahideen were variously backed primarily by the United States, Pakistan, Iran, Saudi Arabia, China, and the United Kingdom; the conflict was a Cold War-era 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. The war caused grave destruction in Afghanistan and is believed to have contributed to the Soviet collapse, in hindsight leaving a mixed legacy to people in both territories.