From the Sasanians to the Khorezmshahs
The long-lived but weakly cohesive Parthian Empire was brought to an end around 220 AD by the defeat of the Parthians by the Sasanians, Zoroastrians from present day southern Iran. Their first major ruler, Ardashir, was by tradition a descendent of a Zoroastrian high priest named Sasan. The Sasanians, who ruled for four centuries are often associated with religious persecution, though in Merv there is evidence that Judaism, Christianity and Buddhism flourished at this time, alongside Zoroastrianism. In the west, the Sasanians continued to fight with Rome and later Byzantium. In the east, problems were caused by incursions of Hephtalite Huns and later Turks from the Altai Mountains.
The conflict-wracked Sasanian Empire faced a new challenge: Islam. Following the death of Prophet Mohammed in 632, the Arab expansion, spreading the Islamic religion, proceeded rapidly. The last Sasanian ruler, Yazdigird III, was killed near Merv in 651. The city of Merv became a centre of Arab colonial expansion, receiving settlers from crowded Mesopotamian cities such as Basra. It was in Merv, in the 740s, that the Abbasid commander Abu Muslim proclaimed the start of the Abbasid rebellion against the Umayyads. Baghdad became the capital of the Islamic world, and Merv the capital of the great province of Khorasan, which gradually moved towards independence from Baghdad's control.
The area was ruled as a fully independent administration from 875 by the Samanids, who held sway for around a century. The Samanids were succeeded by two Turkic dynasties: the Karakhanids in the Syr Darya basin to the north; and in Khorasan the Ghaznavids, whose capital was Ghazna in present-day Afghanistan. Mahmud of Ghazni, who established much of the Ghaznavid Empire, transferred from Gurganj to Ghazna the renowned Academy of Ma'mun after his conquest of Khorezm.
In the 11th century the Turkic Seljuks, from the lower Syr Darya, advanced into i he area, securing a decisive victory over the Ghaznavids in 1040 at Dandanakan, between Merv and Serakhs. The Seljuks were to establish a mighty empire stretching right to the Mediterranean, with Merv as its capital. The Seljuk Empire filtered following the death of Sultan Sanjar in 1157 and the region fell under the control of another Turkic dynasty, the Khorezmshahs. Based in the Khorezm Oasis, the Khorezmshahs were former vassals of the Seljuks who were able to expand their territories rapidly to exploit the vacuum created by the Seljuk decline.