The Military history of Afghanistan (د افغانستان مسلح ځواک) began before 1709 when the Hotaki dynasty was established in Kandahar followed by the Durrani Empire. The Afghan military was re-organized with assistance from the British in 1880, when the country was ruled by Amir Abdur Rahman Khan. It was modernized during King Amanullah Khan's rule in the early 20th century, and then during King Zahir Shah's forty-year rule; the Soviet Union supplied almost all weapons, training and military needs between the 1950s and 1970s. From 1978 to 1992, the Soviet-backed Afghan Armed Forces engaged in heavy fighting with the multi-national mujahideen groups who were then backed by the United States, Pakistan and others. After President Najibullah's resignation in 1992 and the end of Soviet support, the Afghan military dissolved into portions controlled by different factions. This era was followed by the Taliban regime, whose leaders were trained and influenced by the Pakistan Armed Forces.