The territory of Kazakhstan has historically been inhabited by nomadic tribes. This changed in the 13th century, when Genghis Khan occupied the country. Following internal struggles among the conquerors, power eventually reverted to the nomads. By the 16th century, the Kazakhs emerged as a distinct group, divided into three jüz (ancestor branches occupying specific territories). The Russians began advancing into the Kazakh steppe in the 18th century, and by the mid-19th century all of Kazakhstan was part of the Russian Empire. Following the 1917 Russian Revolution, and subsequent civil war, the territory of Kazakhstan was reorganized several times before becoming the Kazakh Soviet Socialist Republic in 1936, an integral part of the Soviet Union.