The Soviet-Afghan War lasted from December 1979, when the Soviet 40th Army arrived to the Afghanistan territory, up untily February 1989, when the last of the Soviets left Afghanistan. In December 1979 a coup was staged and Babrak Karmal took over the rule. The rebellion of the Mujahideen against the government and state regulation had increased and became more irganized throughout the years. The worst battles took place in the Panchir Valley, and the provinces of Kandahar, Paktia, Herat, etc. While the Afghan government was supported by the Soviets, the Mujahideen had received funds and equipment mainly from the United States. After the departure of the Soviets, the Civil War continued.