Agha Mohammad Khan Qajar (Persian: آقا محمد خان قاجار, romanized: Âqâ Mohammad Xân-e Qâjâr; 14 March 1742 – 17 June 1797), also known by his regnal name of Agha Mohammad Shah (آقامحمد شاه), was the founder of the Qajar dynasty of Iran, ruling as Shah from 1789 to 1797, after reunifying the country and establishing Tehran as its capital.
He was the son of Mohammad Hasan Khan, a chieftain of the Quwanlu branch of the Qajar tribe who vied for the throne of Iran after the death of Nader Shah. As a child, he was captured by Nader's successor Adel Shah and castrated. His father was killed in 1759, and in 1763 he was captured by Karim Khan Zand, Iran's new overlord. He spent the next sixteen years as a hostage at Karim Khan's court in Shiraz; after the latter's death, he escaped to northern Iran, where he spent nearly a decade campaigning to consolidate his rule, struggling with his brothers and several Zand pretenders. He took control of all northern Iran and in 1786 made Tehran his capital; it has since remained the country's capital.
Agha Mohammad Khan was enthroned as the king of Iran in 1789 (but not yet crowned), and in 1794 he defeated his last major competitor, the Zand prince Lotf Ali Khan, inflicting immense destruction on the city of Kerman after taking it. In 1796, he campaigned to reassert Iranian rule north of the Aras River, where he forced the local khanates into submission and brutally sacked the Georgian city of Tiflis (Tbilisi). He was then crowned shāhanshāh (King of Kings) in 1796. On 17 June 1797, during a second campaign in the South Caucasus, he was assassinated by two of his servants whom he had condemned to death. He was succeeded by his nephew and designated heir, Fath-Ali, whose descendants ruled Iran until 1925.
Agha Mohammad Khan's reign is noted for the return of a centralized and unified Iran and for relocating the capital to Tehran. He is noted for his cruel and rapacious behavior, particularly during his Georgia and Kerman campaigns. However, he has also been described as a "pragmatic, calculating, and shrewd military and political leader."
Agha Mohammad Khan was born in Astarabad around 1742. He belonged to the Quwanlu (also spelled Qawanlu) branch of the Qajar tribe. The Qajars were one of the original Turkoman Qizilbash tribes that emerged and spread in Asia Minor around the tenth and eleventh centuries. They later supplied power to the Safavids since the dynasty's earliest days. The tribe had several other branches, one of the most prominent ones being the Develu, which often fought against the Quwanlu. Agha Mohammad Khan was the eldest son of the chieftain of the Quwanlu clan, Mohammad Hasan Khan Qajar, and the grandson of Fath-Ali Khan Qajar, a prominent aristocrat executed by the orders of Shah Tahmasp II (possibly compelled by Nader Qoli Beg, who came to be known as Nader Shah after usurping the throne of Iran in 1736, marking the foundation of the Afsharid dynasty). Agha Mohammad Khan had several half-brothers and full-brothers: Hossein Qoli Khan, Morteza Qoli Khan, Mostafa Qoli Khan, Reza Qoli Khan, Jafar Qoli Khan, Mehdi Qoli Khan, Abbas Qoli Khan and Ali Qoli Khan.
When Nader Shah died in 1747, the Afsharid rule of Iran fell apart, which gave Mohammad Hasan an opportunity to seize Astarabad for himself, leading Nader Shah's nephew Adel Shah to march from Mashhad to the city in order to capture him. Although he failed to capture Hasan, Adel Shah managed to capture Agha Mohammad Khan, whom he had castrated and thereafter freed.
According to some sources, the title Agha in Agha Mohammad Khan's name was a reference to the fact that he was a eunuch. Agha (spelled آغا, with the letter ghayn) is a respectful term of Turkic origin for a woman; it was also used to refer to eunuchs employed at the royal court. Aqa (spelled آقا, with the letter qaf), also of Turkic origin, means 'master, elder, older brother, etc.' According to Maziar Behrooz, the use of the spelling Agha as in 'eunuch' in Agha Mohammad's name began only in the Pahlavi period as "a means of humiliating [Agha Mohammad] and his dynasty". Agha Mohammad's enemies did, however, use many insulting terms which referred to his condition, such as Akhta Khan ('the castrated khan').
During the following ten years, Afsharid rule in Khorasan suffered heavily from war among rival chieftains and from invasions by the Durrani ruler of Qandahar, Ahmad Shah Durrani. During this period, Mohammad Hasan fought against the Pashtun military leader Azad Khan Afghan and the Zand ruler Karim Khan for suzerainty over the western part of Nader Shah's former empire. He was, however, defeated in 1759 by a Zand army. He was betrayed by his own followers and thereafter, killed by his old rival, Mohammad Khan of Savadkuh. Due to Agha Mohammad Khan's castration, his brother Hossein Qoli Khan was appointed as the new chieftain of the Quwanlu instead. Shortly thereafter Astarabad fell under the control of Karim Khan, who appointed a Develu named Hossein Khan Develu as its governor. Meanwhile, Agha Mohammad Khan and his brother Hossein Qoli Khan fled to the steppe. One year later, Agha Mohammad Khan made an incursion against Astarabad, but was forced to flee, chased by the city's governor. Agha Mohammad Khan managed to reach Ashraf, but was at last seized and sent as a hostage to Tehran, ruled by Karim Khan. Hossein Qoli Khan was also soon captured and sent to Karim Khan.
During his stay, Agha Mohammad Khan was treated kindly and honorably by Karim Khan, who made him convince his kinsmen to lay down their arms, which they did. Karim Khan then settled them in Damghan. In 1763, Agha Mohammad Khan and Hossein Qoli Khan were sent to the Zand capital, Shiraz, where their paternal aunt Khadija Begum, who was part of Karim Khan's harem, lived. Agha Mohammad Khan's half-brothers Morteza Qoli Khan and Mostafa Qoli Khan were granted permission to live in Astarabad, due to their mother being the sister of the governor of the city. His remaining brothers were sent to Qazvin, where they were treated honorably.
Agha Mohammad Khan was looked upon more as a respected guest in Karim Khan's court than a captive. Furthermore, Karim Khan also acknowledged Agha Mohammad Khan's political knowledge and sought his advice on interests of the state. He called Agha Mohammad Khan his "Piran-e Viseh", referring to an intelligent counselor of the mythical Turanian king Afrasiab in the Shahnameh epic. Two of Agha Mohammad Khan's brothers who were at Qazvin were also sent to Shiraz during this period. In February 1769, Karim Khan appointed Hossein Qoli Khan as the governor of Damghan. When Hossein Qoli Khan reached Damghan, he immediately began a fierce conflict with the Develu and other tribes to avenge his father's death. He was, however, killed c. 1777 near Findarisk by some Turks from the Yamut tribe with whom he had clashed. On 1 March 1779, while Agha Mohammad Khan was hunting, he was informed by Khadija Begum that Karim Khan had died after six months of illness.
Rise to power and unification of Iran (1779–1789)
Conquest of Mazandaran and Gilan
Agha Mohammad Khan took with him a group of loyal followers and left for Tehran. Meanwhile, in Shiraz, people were fighting among themselves. In Tehran, Agha Mohammad Khan met the main chieftains of the Develu clan, with whom he made peace. He visited Shah Abdol-Azim Shrine, where his father's skull was kept. He then travelled to the Mazandaran province, where his first task was to set up his suzerainty among his Quwanlu brothers. This resulted in a clash with his brothers Reza Qoli and Morteza Qoli, whom he defeated on 2 April, conquering Mazandaran. Meanwhile, Morteza Qoli fled to Astarabad, where he fortified himself. Agha Mohammad Khan could not simply storm the city, since starting a war with Morteza Qoli would mean that his frail alliance with the Develu could fall apart—Morteza Qoli's mother was a Develu. At the same time, the Zand prince Ali-Morad Khan Zand sent an army of Zand and Afghan troops under Azad Khan Afghan's son Mahmud Khan to Mazandaran, which Agha Mohammad Khan's brother Jafar Qoli Khan managed to repel. Agha Mohammad Khan, together with Hossein Qoli Khan's sons Fath-Ali Qoli and Hosayn Qoli, was now in a firm position in Babol, the capital of Mazandaran.