the actions and loyalty of professional commanders, formally termed as "military specialists" (voyenspets, for voyenny spetsialist). By 1921 the Red Army had defeated four White armies and held off five armed foreign contingents that had intervened in the civil war, but began to face setbacks in Poland. Polish forces managed to break a long streak of Bolshevik victories by launching a bold counteroffensive at the Battle of Warsaw in August 1920. At Warsaw the Red Army suffered a defeat so great and so unexpected that it turned the course of the entire war and eventually forced the Soviets to accept the unfavorable conditions offered by the Treaty of Riga, signed on March 18, 1921. It was the biggest defeat of the Red Army in history. After the civil war, the Red Army became an increasingly professional military organization. With most of its five million soldiers demobilized, the Red Army was transformed into a small regular force, and territorial militias were created for wartime mobilization. Soviet military schools, established during the civil war, began to graduate large numbers of trained officers loyal to the Soviet power. In an effort to increase the prestige of the military profession, the party reestablished formal military ranks, downgraded political commissars, and eventually established the principle of one-man command. Development of the structure, ideology, and doctrine of the Soviet military Military counterintelligence Throughout the history of the Soviet Army, the Soviet secret police (known variously as the Cheka, GPU, NKVD, among many others) maintained control over the counterintelligence Special Departments (Особый отдел) that existed at all larger military formations. The best known was SMERSH (1943–1946) created during the Great Patriotic War. While the staff of a Special Department of a regiment was generally known, it controlled a network of secret informants, both chekists and recruited ordinary military. Political doctrine Under the direction of Lenin and Trotsky, the Red Army claimed to adhere to Karl Marx's proclamation that the bourgeoisie could be overcome only by a worldwide revolt of the proletariat, and to this end early Soviet military doctrine focused on spreading the revolution abroad and expanding Soviet influence throughout the world. Lenin provided an early experiment of Marx's theory when he invaded Poland in hopes of generating a communist uprising in neighboring Germany. Lenin's Polish expedition only complemented his March 1919 establishment of the Comintern, an organization whose sole purpose was to fight "by all available