the same time the Rapallo treaty was signed it set up a secret system for hosting large-scale training and research facilities for the German army and air force, despite the strict prohibitions on Germany in the Treaty of Versailles. These facilities operated until 1933. The Soviet Union finalized a treaty of friendship with Afghanistan, which had gained full independence following the Third Anglo-Afghan War. The Afghan king, Amanullah Khan, wrote to Moscow stressing his desire for permanent friendly relations; Lenin replied congratulating him and the Afghans for their defense. The Soviets saw possibilities in an alliance with Afghanistan against the United Kingdom, such as using it as a base for a revolutionary advance towards British-controlled India. The treaty of friendship was finalized in 1921. Communist International The Communist International (Comintern), (1919–1943), was an international organization of communist parties. Obstensibly a new group to replace the former Second International after it had collapsed because of World War I, it served as an extension of Soviet foreign policy. It was headed by Grigory Zinoviev (1919–26) and based in the Kremlin; it reported to Lenin and later Stalin. Lenin envisioned the national branches not as political parties, but "as a centralized quasi-religious, and quasi-military movement devoted to the revolution and to service of the Soviet state." Commentators compared it to the Jesuit order, with its vow of obedience. It coordinated the different parties and issued orders that they obeyed. The Comintern resolved at its Second Congress to "struggle by all available means, including armed force, for the overthrow of the international bourgeoisie and the creation of an international Soviet republic as a transition stage to the complete abolition of the state". That policy was soon dropped by 1921 because it interfered with the decision to seek friendly relations with capitalistic nations. The new economic policy at home required trade with the West and bank credits if possible. The main obstacle was Moscow's refusal to honor Tsarist era debts. The Comintern was officially dissolved by Stalin in 1943 to avoid antagonizing its new allies against Germany, the United States and Great Britain. Stalin: Socialism in one country Trotsky argued for the continuation of the revolutionary process, in terms of his theory of permanent revolution. After Lenin's death in 1924, Trotsky was defeated by Stalin and Nikolai Bukharin. Trotsky was sent into exile and in 1940 was assassinated on Stalin's orders. Stalin's main policy was