After the Third Anglo-Afghan War, Afghanistan had full independence from the British Empire, and could make their own foreign relations. Amanullah Khan, the king of Afghanistan, made relations with the USSR, among many other countries, such as signing an agreement of neutrality. There had also been another treaty signed that gave territory to Afghanistan on the condition that they stop Basmachi raids into the USSR. As his reign continued, Amanullah Khan became less popular, and in November 1928 rebels rose up in the east of the country. The Saqqawists allowed Basmachi rebels from the Soviet Union to operate inside the country after coming to power. The Soviet Union sent 1,000 troops into Afghanistan to support Amanullah Khan. When Amanullah fled the country, the Red Army withdrew from Afghanistan. Despite the Soviet withdrawal, the Saqqawists would be defeated later, in 1929.