Ma'munids
The Maʾmunids () were an independent dynasty of Iranian rulers in Khwarazm. Their reign was short-lived (995–1017), and they were in turn replaced by the expansionist Ghaznavids. History. The ancient Iranian kingdom of Khwarazm had been ruled until 995 by the old established line of Afrighids of Kath. Khwarazm, or the classical Chorasmia, was the well irrigated and rich agricultural region of lower Oxus. Surrounded on all sides by steppe land and desert, it was geographically isolated from other areas of civilization. This isolation allowed it to maintain a separate distinctive Iranian language and culture. 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.