Merv (Turkmen: Merw [ˈmeɾβ]; Persian: مرو [ˈmæɹv]), also known as the Merve Oasis, was a major Iranian city in Central Asia, located on the historical Silk Road, near today's Mary, Turkmenistan. Human settlements on the site of Merv existed from the 3rd millennium BC until the 18th century AD. It changed hands repeatedly throughout history. Under the Achaemenid Empire, it was the center of the satrapy of Margiana. It was subsequently ruled by Hellenistic Kings, Parthians, Sasanians, Arabs, Ghaznavids, Seljuqs, Khwarazmians and Timurids, among others.
Merv served as the capital of several polities throughout its history. In the beginning of the 9th century, Merv was the seat of the caliph al-Ma'mun and the capital of the entire Islamic caliphate. It served later as the seat of the Tahirid governors of Khorasan. In the 11th–12th centuries, Merv was the capital of the Great Seljuk Empire and remained so until its ultimate fall. Around this time, Merv turned into a chief centre of Islamic science and culture, attracting as well as producing renowned poets, musicians, physicians, mathematicians and astronomers. The great Persian polymath Omar Khayyam, among others, spent a number of years working at the observatory in Merv. As Persian geographer and traveller al-Istakhri wrote of Merv: "Of all the countries of Iran, these people were noted for their talents and education." Arab geographer Yaqut al-Hamawi counted as many as 10 giant libraries in Merv, including one within a major mosque that contained 12,000 volumes.