Khwarazmshah was an ancient title used regularly by the rulers of the Central Asian region of Khwarazm starting from the Late Antiquity until the advent of the Mongols in the early 13th-century, after which it was used infrequently. There were a total of four families who ruled as Khwarazmshahs—the Afrighids (305–995), Ma'munids (995–1017), the line of Altuntash (1017–1041), and the most prominent ones, the Anushteginids (1097–1231). Like other contemporary Central Asian titles, such as Afshin and Ikhshid, the title of Khwarazmshah is of Iranian origin.

History

Afrighids

Most of Afrighid history is recorded by the Khwarazmian scholar al-Biruni (died 1050), whose reliability has been questioned. According to the latter, the Afrighids were founded by Afrig in 305, succeeding the semi-legendary line of the Siyavushids, founded by the Iranian king Kay Khosrow. However, extensive Soviet archeological findings demonstrate that al-Biruni was in reality not well-acquainted with pre-Islamic Khwarazmian history. Coin findings show that before the advent of the Afrighids, Khwarazm was part of the Parthian Empire. The start of the Khwarazmian era seemingly took place in the early 1st-century, after they had freed themselves of Parthian rule, and established their own local dynasty of shahs. The dynastic name of "Afrighid" (Khwarazmian: ʾfryḡ) is not attested anywhere besides al-Biruni, which has led scholars to suggest that the name never existed. Likewise, many of the Khwarazmshahs recorded by al-Biruni are not supported by archeological evidence; however, this may be due to scribal errors. 

The Afrighids and the local population were most likely adherents of Zoroastrianism. The first Khwarazmshah to convert to Islam was Azkajwar-Abdallah, who ruled in the early 9th-century, perhaps coinciding with the reign of the Abbasid caliph al-Ma'mun (). Regardless, the Islamization of the local population was much slower. In the early 10th-century, the Khwarazmshahs were made vassals of the Samanid dynasty, a Persian family which ruled mainly in Transoxania and Khurasan. Although the Khwarazmshahs sometimes granted sanctuary to Samanid rebels, they generally ruled a peaceful domain. During the end of the Samanids, the Khwarazmshahs extended their rule as far as the northern edges of Khurasan, ruling frontier posts such as Farawa and Nasa.

An uncertain part of Khwarazmian history is the rise of Ma'munid family, who came to rule their hometown of Gurganj, one of the three main cities of the country. The city had risen to rival the Afrighid capital of Kath, most likely due to its commercial success as a trading post between the steppe and the Kievan Rus'. The Ma'munids and Afrighids eventually became rivals, with conflict soon ensuing. The Ma'munid Ma'mun I deposed and killed the Afrighid shah Abu 'Abdallah Muhammad (), thus marking the end of the first Khwarazmshah line of the Afrighids, and the inauguration of the second Khwarazmshah line of the Ma'munids.

Ma'munids

Under the Ma'munids, their capital of Gurganj became a centre of learning, attracting many prominent figures, such as the philosophers Avicenna and Abu Sahl al-Masihi, the mathematician Abu Nasr Mansur, the physician Ibn al-Khammar, and the philologist al-Tha'alibi. The Ma'munids also embellished their capital with buildings such as a minaret which still survives till this day, and has an inscription crediting Ma'mun II () its founder. However, the Ma'munids soon fell into conflict with the Ghaznavid Sultan Mahmud (), who sought to pressurize his Qarakhanid enemies by extending his rule into Khwarazm. In 1014, Mahmud demanded that Ma'mun II should add his name in the khutba (Friday sermon) in Khwarazm, thus acknowledging his suzerainty. Unable to gain military assistance or appease Mahmud through other means, Ma'mun II was forced to accept his demands, much to the dislike of the Khwarazmian nobles and military officers. 

This eventually resulted in a patriotic revolt, led by the commander-in-chief Alptigin, which led to the murder of Ma'mun II and accession of his nephew Abu'l-Harith Muhammad in March 1017. Ma'mun II was the brother-in-law of Mahmud, which afforded the latter a pretext to invade Khwarazm. The Ghaznavid army defeated the local Khwarazmian forces at Hazarasp, brutalized the population of Gurganj, and captured many Khwarazmians, who were taken to the capital of Ghazni as slaves. Abu'l-Harith Muhammad was deposed and imprisoned, while Khwarazm was incorporated into the Ghaznavid realm, thus marking the end of the Ma'munid dynasty, the last ethnically Iranian line of Khwarazmshahs.

The line of Altuntash
Due to the difficulty to control a distant area such as Khwarazm, Mahmud installed his Turkic slave commander () Altuntash as the governor of the region, with the traditional title of Khwarazmshah, thus marking the start of the third line of Khwarazmshahs. A loyal servant of the Ghaznavids, Altuntash protected the borders of Khwarazm by enlisting additional soldiers from the Turkic groups of Qipchaq, Kujet and Chaghrat. He died of wounds in the aftermath of the Battle of Dabusiyya against the Qarakhanid ruler Ali-Tigin () in 1032. Although Sultan Mas'ud I () appointed his own son Sa'id as the new Khwarazmshah, the de facto ruler of Khwarazm was Altuntash's son Harun, who was the khalifat al-dar (lieutenant) of Sa'id. In 1034, in an alliance with the Seljuk Turks, Harun rebelled against Mas'ud, but was the following year assassinated at the instigation of the latter. Harun was succeeded by his brother Ismail Khandan, who was able to rule as an independent monarch as Mas'ud I was occupied with the Seljuk invasions. In 1038, Mas'ud gave the governorship of Khwarazm to his ally, Shah Malik, the Oghuz Yabghu of Jand. In 1041, Ismail was expelled from Khwarazm by the latter, who declared himself ruler at Gurganj, thus marking the end of the Altuntash line. During this period, however, Mas'ud had already died and Ghaznavid rule in the west had crumbled.

Anushtegin dynasty

A year after Shah Malik's conquest of Khwarazm, he was expelled by the Seljuk leaders Tughril and Chaghri Beg. From henceforth Khwarazm was a Seljuk province, although the title of Khwarazmshah was unused until , when the Turkic  Anushtegin Gharchai was made its governor by Sultan Malik-Shah I (). He was succeeded by fellow Turkic  Ekinchi as Khwarazmshah in 1097, but the latter died in the same year. Sultan Berkyaruq () then made Anushtegin's son Qutb al-Din Muhammad (who became known as Muhammad I) the new Khwarazmshah, thus marking the start of the fourth and final Khwarazmshah line of the Anushteginids. 

Muhammad I was loyal to the Seljuks, attending the Seljuk court with diligence. It was his son and successor Atsiz () who established the Khwarazmshahs' grandeur, being determined in his pursuit of autonomy and expansion of his realm, conquering the Turkmens of the eastern Caspian shores and the Manghislak peninsula. Regardless, he nominally acknowledged the suzerainty of Sultan Ahmad Sanjar () till the end of his reign. Atsiz's son and successor Il-Arslan was able to gain greater autonomy after the death of Sanjar and disintegration of Seljuk authority in the east. As long as he paid tribute to the Qara Khitai, they had little interest in meddling in his affairs, and thus he was free to focus on expanding his rule into the Qarakhanid domains. 

The power of the Khwarazmshahs even further increased under Il-Arslan's son and successor Ala al-Din Tekish () was able to slow down the Ghurid expansion into Khurasan and destroy the Seljuk Empire. Furthermore, he also declared independence against his Qara Khitai suzerains, whose attacks he repelled. At the time of his death, his realm stretched as far as Persian Iraq to the west. His son and successor Muhammad II () was occupied with his rivals in the east (Ghurids, Qara Khitai, the Qipchaq of the northern steppes, and the Qarakhanids) for much of his reign. He initially maintained cordial relations with the Qara Khitai, who helped him fend off the 1204 invasion of Khurasan by the Ghurid ruler Mu'izz al-Din Muhammad Ghuri (), who later died in 1206. His death led to the disintegration of his empire, and Khwarazmian conquest over much of it. 

He could now distance himself from the Qara Khitai, and while the latter were preoccupied by the revolt of the Mongol leader Kuchlug in Semirechye, Muhammad II capitalized on this by defeating and killing the Qarakhanid leader Uthman Khan, thus putting an to Qarakhanid rule in Transoxiana. Muhammad II was now a towering figure in the eastern Islamic world, but like his father, was content with the limited titles of Khwarazmshah and Sultan. He now sought to the deal with the Abbasid Caliphate, who had in the past supported the Ghurids against him; he marched towards Baghdad, but the extreme weather conditions during the winter and unrest amongst the Qipchaq forced him to return to Khwarazm. His son and successor Jalal al-Din Mangburni () was unable to contain the Mongol invasions, which led to the collapse of the Khwarazmian Empire.

Aftermath
The title of Khwarazmshah was seemingly unused by the Mongol governors of Khwarazm and the later Sufi dynasty. It was revived under the Timurid Empire, after which it was infrequently used, such as under Shah Malik, the governor of Khwarazm under Shah Rukh ().

References

Sources

Further reading 
 

Iranian words and phrases
Royal titles
Khwarazm