The first Kazakhs were Turkic-speaking nomads who broke away from the Mongol empire in 1465 to settle between the Chu and Talas rivers. An enterprising group, by the early 16th century they had formed an empire of their own under the charismatic rule of Kasym Khan.

But Kasym's death in 1518 brought a reversal of fortunes. Central authority disintegrated, and the Khanate split into three separate entities, controlled by the Great, Middle and Little Hordes. A series of wars that began in the 1680s with the Oyrat, a federation of Mongol tribes, further weakened its political homogeneity. Temporary reunification and counteroffensive came under Teuke Khan (1680-1718), who formed a code of law fusing Islamic and local traditions, but long-term peace remained elusive. In 1723, the “Great Disaster”—an invasion by the Dzungars, one of the Oyrat tribes— destabilised the region again, this time giving China's expansionist Manchu empire a chance to intervene. China incorporated a large part of eastern Kazakh territory in 1771.

The power vacuum that remained in the western territory drew the attention of Russia, which took control of land through a slow process of encroachment. In 1731 the Little Horde accepted Russian protection, and by 1848 the Russian Empire had absorbed what remained of Kazakh territory.

Independent-minded Kazakhs attempted to win autonomy and cultural rights during the Russian Revolution. They formed a provisional government after 1917, but by 1920 Kazakhstan was in the Red Army's control. In 1936, the Kazakh Soviet Socialist Republic was declared. A brutal collectivisation of agriculture killed about one-fifth of the population between 1926 and 1939, and forced many to flee Kazakhstan. Many Slavs moved in to replace them, and after 1941, Stalin began deporting ethnic Germans and other minority groups into settlements in Kazakhstan.

Matters improved only after Stalin's death in 1953. Huge wheat plantations were established and the Soviets began to use Kazakhstan as a base for their space and nuclear programmes. Dinmukhamed Kunayev, the Kazakh Communist Party first secretary between 1959 to 1986, and the only Kazakh ever in the Soviet Politburo, fostered better relations between Slavs and Kazakhs.

Kazakhstan broke from the Soviet Union in October 1990 and proclaimed independence in December 1991, after which Nursultan Nazarbaev, the Kazakh Communist Party first secretary, became president. He began consolidating his own power and gradually restricting the new country's democratic freedoms, winning a referendum to cancel the 1996 election and securing a new seven-year term in a 1999 poll that was widely condemned as rigged.