Historically inhabited by the Indo-Iranians, the written history of Turkmenistan begins with its annexation by the Achaemenid Empire of Ancient Iran. In the 8th century AD, Turkic-speaking Oghuz tribes moved from Mongolia into present-day Central Asia. Part of a powerful confederation of tribes, these Oghuz formed the ethnic basis of the modern Turkmen population. In the 10th century, the name « Turkmen » was first applied to Oghuz groups that accepted Islam and began to occupy present-day Turkmenistan. There they were under the dominion of the Seljuk Empire, which was composed of Oghuz groups living in present-day Iran and Turkmenistan. Turkmen soldiers in the service of the empire played an important role in the spreading of Turkic culture when they migrated westward into present-day Azerbaijan and eastern Turkey.
In the 12th century, Turkmen and other tribes overthrew the Seljuk Empire. In the next century, the Mongols took over the more northern lands where the Turkmens had settled, scattering the Turkmens southward and contributing to the formation of new tribal groups. The sixteenth and eighteenth centuries saw a series of splits and confederations among the nomadic Turkmen tribes, who remained staunchly independent and inspired fear in their neighbors. By the 16th century, most of those tribes were under the nominal control of two sedentary Uzbek khanates, Khiva and Bukhoro. Turkmen soldiers were an important element of the Uzbek militaries of this period. In the 19th century, raids and rebellions by the Yomud Turkmen group resulted in that group’s dispersal by the Uzbek rulers. According to Paul R. Spickard, « Prior to the Russian conquest, the Turkmen were known and feared for their involvement in the Central Asian slave trade. »
Russian forces began occupying Turkmen territory late in the 19th century. From their Caspian Sea base at Krasnovodsk (now Turkmenbashi), the Russians eventually overcame the Uzbek khanates. In 1881, the last significant resistance in Turkmen territory was crushed at the Battle of Geok Tepe, and shortly thereafter Turkmenistan was annexed, together with adjoining Uzbek territory, into the Russian Empire. In 1916 the Russian Empire’s participation in World War I resonated in Turkmenistan, as an anticonscription revolt swept most of Russian Central Asia. Although the Russian Revolution of 1917 had little direct impact, in the 1920s Turkmen forces joined Kazakhs, Kyrgyz, and Uzbeks in the so-called Basmachi Rebellion against the rule of the newly formed Soviet Union. In 1924 the Turkmen Soviet Socialist Republic was formed from the tsarist province of Transcaspia. By the late 1930s, Soviet reorganization of agriculture had destroyed what remained of the nomadic lifestyle in Turkmenistan, and Moscow controlled political life. The Ashgabat earthquake of 1948 killed over 110,000 people, amounting to two-thirds of the city’s population.
During the next half-century, Turkmenistan played its designated economic role within the Soviet Union and remained outside the course of major world events. Even the major liberalization movement that shook Russia in the late 1980s had little impact. However, in 1990 the Supreme Soviet of Turkmenistan declared sovereignty as a nationalist response to perceived exploitation by Moscow. Although Turkmenistan was ill-prepared for independence and communist leader Saparmurad Niyazov preferred to preserve the Soviet Union, in October 1991 the fragmentation of that entity forced him to call a national referendum that approved independence. On December 26, 1991, the Soviet Union ceased to exist. Niyazov continued as Turkmenistan’s chief of state, replacing communism with a unique brand of independent nationalism reinforced by a pervasive cult of personality. A 1994 referendum and legislation in 1999 abolished further requirements for the president to stand for re-election (although in 1992 he completely dominated the only presidential election in which he ran, as he was the only candidate and no one else was allowed to run for the office), making him effectively president for life. During his tenure, Niyazov conducted frequent purges of public officials and abolished organizations deemed threatening. Throughout the post-Soviet era, Turkmenistan has taken a neutral position on almost all international issues. Niyazov eschewed membership in regional organizations such as the Shanghai Cooperation Organisation, and in the late 1990s he maintained relations with the Taliban and its chief opponent in Afghanistan, the Northern Alliance. He offered limited support to the military campaign against the Taliban following the 11 September 2001 attacks. In 2002 an alleged assassination attempt against Niyazov led to a new wave of security restrictions, dismissals of government officials, and restrictions placed on the media. Niyazov accused exiled former foreign minister Boris Shikhmuradov of having planned the attack.
Between 2002 and 2004, serious tension arose between Turkmenistan and Uzbekistan because of bilateral disputes and Niyazov’s implication that Uzbekistan had a role in the 2002 assassination attempt. In 2004 a series of bilateral treaties restored friendly relations. In the parliamentary elections of December 2004 and January 2005, only Niyazov’s party was represented, and no international monitors participated. In 2005 Niyazov exercised his dictatorial power by closing all hospitals outside Ashgabat and all rural libraries. The year 2006 saw intensification of the trends of arbitrary policy changes, shuffling of top officials, diminishing economic output outside the oil and gas sector, and isolation from regional and world organizations. China was among a very few nations to whom Turkmenistan made significant overtures. The sudden death of Niyazov at the end of 2006 left a complete vacuum of power, as his cult of personality, compared to that of former president Kim Il-sung of North Korea, had precluded the naming of a successor. Deputy Prime Minister Gurbanguly Berdimuhamedow, who was named interim head of government, won the special presidential election held in early February 2007. He was re-elected in 2012 with 97% of the vote.