Prior to the 17th century China and Russia were on opposite ends of Siberia, which was populated by independent nomads. By about 1640 Russian settlers had traversed most of Siberia and founded settlements in the Amur River basin. From 1652 to 1689, China's armies drove the Russian settlers out, but after 1689, China and Russia made peace and established trade agreements. By the mid-19th century, China's economy and military lagged far behind the colonial powers. It signed unequal treaties with Western countries and Russia, through which Russia annexed the Amur basin and Vladivostok. The Russian Empire and Western powers exacted many other concessions from China, such as indemnities for anti-Western riots, control over China's tariffs, and extraterritorial agreements including legal immunity for foreigners and foreign businesses. Meanwhile, Russian culture and society, especially the elite, were westernized. The ruler of Russia officially was no longer called tsar but emperor, an import from Western Europe. Issues that affected only Russia and China were mainly the Russian-Chinese border since Russia, unlike the Western countries, bordered China. Many Chinese people felt humiliated by China's submission to foreign interests, which contributed to widespread hostility towards the emperor of China. In 1911, the Xinhai Revolution broke out and led to the establishment of the Republic of China. However, China's new regime, known as the Beiyang government, was forced to sign more unequal treaties with Western countries and with Russia. In recent years, Russia and China signed a border agreement. In late 1917, Moscow and Petrograd were taken over by a communist group, the Bolsheviks, during the October Revolution, which caused the Russian Civil War between the Bolshevik Red Army and the anticommunist White forces. China's Beiyang government sided with the Whites and, along with most of the West, sent troops to fight against the Reds. In 1922, the Reds won the civil war and established a new country: the Soviet Union. In 1923, the Soviets provided aid and support to the Kuomintang, a Chinese faction that had been opposed to the Beiyang government. In alliance with the small Chinese Communist Party (CCP), the Kuomintang seized power in 1928, and both countries established diplomatic ties. Sino–Soviet relations remained fractious, and both countries fought two wars for the next ten years. Nevertheless, the Soviets, under Joseph Stalin, helped Chiang Kai-shek's Kuomintang government against Imperial Japan. Stalin told the Communists' leader, Mao Zedong, to co-operate with China's Kuomintang regime,