[custom_adv] The Qajar dynasty was a royal dynasty of Turkic origin, specifically from the Qajar tribe, which ruled from 1794 to 1925. The state ruled by the dynasty was officially known as the Sublime State of Persia. [custom_adv] The Qajar family took full control in 1794, deposing Lotf 'Ali Khan, the last Shah of the Zand dynasty, and re-asserted sovereignty over large parts of the Caucasus. [custom_adv] In 1796, Mohammad Khan Qajar seized Mashhad with ease, putting an end to the Afsharid dynasty, and Mohammad Khan was formally crowned as Shah after his punitive campaign against Georgian subjects. [custom_adv] In the Caucasus, the Qajar dynasty permanently lost many of integral areas to the Russians over the course of the 19th century, comprising modern-day Georgia, Dagestan, Azerbaijan and Armenia. [custom_adv] The Qajar rulers were members of the Karagöz or "Black-Eye" sect of the Qajars, who themselves were members of the Qajars (tribe) or "Black Hats" lineage of the Oghuz Turks. [custom_adv] Qajars first settled during the Mongol period in the vicinity of Armenia and were among the seven Qizilbash tribes that supported the Safavids. [custom_adv] The Safavids "left Arran (present-day Republic of Azerbaijan) to local Turkic khans", and, "in 1554 Ganja was governed by Shahverdi Soltan Ziyadoglu Qajar, whose family came to govern Karabakh in southern Arran". [custom_adv] Qajars filled a number of diplomatic missions and governorships in the 16–17th centuries for the Safavids. The Qajars were resettled by Shah Abbas I throughout. [custom_adv] The great number of them also settled in Astarabad (present-day Gorgan) near the south-eastern corner of the Caspian Sea, and it would be this branch of Qajars that would rise to power. [custom_adv] The immediate ancestor of the Qajar dynasty, Shah Qoli Khan of the Quvanlu of Ganja (also spelled Ghovanloo or Ghovanlou), married into the Quvanlu Qajars of Astarabad. [custom_adv] His son, Fath Ali Khan (born c. 1685–1693) was a renowned military commander during the rule of the Safavid shahs Sultan Husayn and Tahmasp II. He was killed on the orders of Shah Nader Shah in 1726. [custom_adv] Fath Ali Khan's son Mohammad Hasan Khan Qajar (1722–1758) was the father of Mohammad Khan Qajar and Hossein Qoli Khan (Jahansouz Shah), father of "Baba Khan," the future Fath-Ali Shah Qajar. Mohammad Hasan Khan was killed on the orders of Karim Khan of the Zand dynasty. [custom_adv] Within 126 years between the demise of the Safavid state and the rise of Naser al-Din Shah Qajar, the Qajars had evolved from a shepherd-warrior tribe with strongholds in northern dynasty with all the trappings of a Perso-Islamic monarchy. [custom_adv] In 1779 following the death of Karim Khan of the Zand dynasty, Mohammad Khan Qajar, the leader of the Qajars, set out to reunify. Mohammad Khan was known as one of the cruelest kings, even by the standards of 18th-century. [custom_adv] In his quest for power, he razed cities, massacred entire populations, and blinded some 20,000 men in the city of Kerman because the local populace had chosen to defend the city against his siege. [custom_adv] The Qajar armies at that time were mostly composed of Turkomans and Georgian slaves. By 1794, Mohammad Khan had eliminated all his rivals, including Lotf Ali Khan, the last of the Zand dynasty. [custom_adv] Agha Mohammad established his capital, a village near the ruins of the ancient city of Rayy. In 1796, he was formally crowned as shah.