Qajar Principality of Merv
The Qajar Principality of Merv was an independent principality that existed in Central Asia from c.1747 to 1788. It was ruled by the 'Izz al-Dinlu clan of the Qajars of Merv, who had been governors of the oasis since Safavid times. It gained its independence after the death of Nader Shah in 1747 and had good relations with the ruler of Bukhara, Daniyal Biy. When his son, Shah Murad took over in 1785, he launched a campaign that killed the ruler of the principality, Bayram 'Ali Khan Qajar. By 1788 the entire oasis was conquered and annexed to Bukhara. The last ruler, Mohammad Husayn Khan, fled to Iran. Background 
In the 16th century, the region of Merv was disputed between the Khiva Khanate, Bukhara Khanate and the Safavid Empire. Although Isma'il I had conquered it with the Battle of Merv, it soon was lost and became a dependency of Khiva. Under 'Abdallah Khan Bukhara gained control of Merv in 1593. However, a few years later Shah 'Abbas the Great's campaigns against the Uzbeks resulted in a Safavid governor (Biktash Khan Ustajlu) being appointed to Merv in 1600. In 1608, he was succeeded as governor by Mihrab Khan Qajar, the first of a long series of Qajar governors of Merv. A large portion of Merv's population consisted of tribesmen that Shah 'Abbas had resettled in the region. During the late 17th and early 18th centuries, Merv began to decline as an economic and political center. The Qajars of Merv began to assert their independence from the declining power of the Safavid state. From 1715, the Qajar chieftain Mohammad 'Ali Beg expelled three consecutive governors of Merv, assuming complete sovereignty after the fall of Isfahan in 1722. Malek Mahmoud Sistani also unsuccessfully tried to assert his authority over Merv. In 1723–24, coinciding with detrimental conditions in the oasis, Nader Shah Afshar began to intervene in the politics of Merv on behalf of the Qajar rulers. He tried to prop up Mohammad 'Ali Beg's successor Fulad Beg as governor but he was killed by the Tatars, who then began to ravage the oasis. Within a decade Nader destroyed the Tatar and Turkmen power around Merv. Kalb 'Ali Khan Afshar, the governor of Merv from 1738 onwards, revived the irrigation system which had been devastated by raids, and discouraged Turkmen raiding activities to the point where they only entered the oasis for commerce. During the 1740 campaign against Bukhara, Nader ordered the chiefs of Merv to provide supplies to the army. However, despite all of these measures many of his soldiers died during the march through the desert, which encouraged Nader to launch a purge of the provincial government. Most of the local administrators were killed, and Nader Shah installed Shah Qoli Beg Qajar bin Mohammad 'Ali Beg as the local governor of Merv and revived the hereditary Qajar rule over the city. During the last years of Nader Shah's rule Shah Qoli Beg Qajar revolted against demands for high taxes, but he was arrested and blinded. History 
With the death of Nader Shah in 1747, Merv was able to become an independent principality. The beglerbegi 'Ali Naqi Khan Qajar briefly occupied Mashhad in 1751, intervening in the affairs of Khorasan (which had by this time dissolved into anarchy as Shahrokh Shah was unable to assert his authority over the local tribal chiefs). The isolation of Merv and the fertile agricultural resources of the oasis allowed the Qajar chieftains to assert their independence, especially considering the turmoil its neighbors (Iran, Khiva, and Bukhara) were going through at the time. One 18th century visitor put the population of the oasis at around 15,000 people. The city was sustained by a dam on the Murghab, and the Qajar chiefs maintained a fort there in order to protect the area. The most prominent and last ruler of the principality was Bayram 'Ali Khan Qajar, who maintained good relations with Daniyal Biy of Bukhara. They had a paternal friendship, and Daniyal Biy would address Bayram 'Ali Khan Qajar as his son (farzand). Bukharan Conquest 
Upon the death of Daniyal Biy in 1785, Bayram 'Ali Khan Qajar sent gifts to his son and successor, Shah Murad. However, Shah Murad would assume a hostile tone towards the Qajars as he wanted to use Merv as a base of operations against Iran. In 1785–86, Shah Murad launched his first campaign towards Merv. Bayram 'Ali Khan Qajar was killed and his head was sent to Bukhara and nailed on the gallows. After the withdraw of Bukharan forces, the people of Merv brought Bayram 'Ali Khan's son, Hajji Mohammad Husayn, back from Mashhad to become the next ruler. In 1788 Shah Murad led his second campaign towards Merv, conquering the city and destroying the irrigation system. The principality was brought to an end as Hajji Mohammad Husayn was forced to flee to Iran for his safety. Sources

References 

History of Turkmenistan
Qajar tribe
Qajar governors
History of Central Asia
Merv