Merv ( Merw, Мерв, مرو; مرو, Marv), also known as the Merve Oasis, formerly known as Alexandria (Ἀλεξάνδρεια), Antiochia in Margiana (Ἀντιόχεια ἡ ἐν τῇ Μαργιανῇ) and Marw al-Shāhijān, was a major Iranian city in Central Asia, 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 centre of the satrapy of Margiana. It was subsequently ruled by the ancient Macedonians, Seleucids, Parthians, Sasanians, Arabs, Ghaznavids, Seljuqs, Khwarazmians and Timurids, among others.
Merv was the capital city 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 the latter's 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. 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.
Merv was also a popular place for , and several religions considered it holy. In Zoroastrianism, Merv (Mouru) was one of 16 perfect lands created by god Ahura Mazda. Between the 5th and 11th centuries, Merv served as the seat of an East Syrian metropolitan province. The Muslim scholar (8th Imam of Twelver Shīʿism) Ali ar-Ridha, moved to Merv from Baghdad and resided there for several years.