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. In Autumn 1780 Reza Qoli invaded Babol with an army of men from
Larijan, where he encircled Agha Mohammad Khan's house and captured him after a fight lasting several hours. When Morteza Qoli learned of this, he marched to Babol on 1 January 1781 with an army of Turkmens and released Agha Mohammad Khan. Agha Mohammad Khan and Reza Qoli were initially reconciled, but the latter was still discontented and fled to Ali-Morad Khan in
Isfahan, and then to
Sadeq Khan Zand in Shiraz. He died in Khorasan, and his former supporters went over to Agha Mohammad's side and fought with him against Morteza Qoli, who sought to take Mazandaran. Agha Mohammad defeated his brother but agreed to let him rule Astarabad and collect revenue from several districts in Mazandaran Peace did not last long. Ali-Morad Khan soon invaded Mazandaran, which led Agha Mohammad Khan to march from Babol with an army of
Mazandaranis and Qajars and attack Ali-Morad Khan, whom he managed to repel from the province. Agha Mohammad Khan then seized
Qumis,
Semnan,
Damghan,
Shahrud and
Bastam. Furthermore, he also made
Hedayat-Allah Khan, the ruler of
Gilan, his vassal. He thereafter granted land in Semnan to his brother Ali Qoli as a reward for his help in the conquest of the cities.
First conflict with the Russians, dispute with Gilan, and the invasion of northern Persian Iraq In 1781, the
Russian Empire, which was interested in building a
trade route with Iran in order to be able to trade with regions deep into Asia, sent an emissary under
Marko Ivanovich Voinovich to the coast of Gorgan, where he arrived on 10 August and sought approval to build a trading-post at
Ashraf. When Agha Mohammad Khan refused, Voinovich ignored his refusal and went on to establish an interim settlement on
Ashurada island. With no ships, Agha Mohammad Khan was unable to retake the island. Instead, he tricked Voinovich and some of his men into meeting him at Astarabad for a banquet on 26 December, where they were held as captives until Voinovich agreed to order his men to leave Ashurada on 13 January 1782. A year later Agha Mohammad Khan invaded Gilan, because its ruler Hedayat-Allah had changed his allegiance to the Zand dynasty. Hedayat-Allah then sent two diplomats, Mirza Sadeq and Agha Sadeq Lahiji, to Agha Mohammad to make peace. As a precaution he went to
Shirvan. The diplomats were unable to come to favorable terms with Agha Mohammad Khan, who raided Gilan's capital
Rasht and seized its riches. Rejoicing in his victory, he sent his brother Jafar Qoli Khan to conquer the northern part of
Persian Iraq. He defeated a Zand army in
Ray (or
Karaj), and thereafter seized
Qazvin. He then marched to
Zanjan, which he also seized.In autumn they returned to Mazandaran. In the spring of 1783, Agha Mohammad Khan besieged Tehran, a town under Zand control which had proved troublesome. During the siege, plague started spreading in the town, and thereafter to Agha Mohammad Khan's army camp outside the city, which forced him to lift the siege. He marched back to Ali Bolagh, a summer house near Damghan. Agha Mohammad Khan then returned to Mazandaran and spent the winter there. to Mazandaran in June 1784, aiming to crush the Qajars once and for all. His 15-year-old son Sheikh Veis Khan was put in command of the army, with Ali Morad staying behind in Tehran. When the army arrived in Mazandaran, its people quickly surrendered to the Zands and the nobles defected. Agha Mohammad Khan and a few of his supporters fled to Astarabad, where he tried to fortify the city as much as possible. Meanwhile, Morteza Qoli changed his allegiance and began serving the Zand dynasty. Ali-Morad Khan then sent an army numbering 8,000 under his relative Mohammad Zahir Khan to Astarabad, and laid siege to the city. Agha Mohammad Khan had already stocked provisions in case of a siege. Every day his troops would try to lay waste to the countryside to limit the besiegers' provisions. This in the end made the besiegers' situation unsustainable, and allowed Agha Mohammad Khan to leave the city to attack them. Mohammad Zahir Khan fled towards the
Karakum Desert, but was captured by Agha Mohammad Khan's
Yomut allies and was brutally killed. Only a few of his men managed to survive. On 14 November Agha Mohammad marched from Astarabad into Mazandaran and defeated a Zand force at Ashraf. The Zands were unable to defend Sari and Sheikh Veis Khan fled to Tehran on 23 November.
First war with Jafar Khan Zand Meanwhile, Ali-Morad Khan had raised another group of Zand troops, which he sent to Mazandaran under the command of his cousin
Rustam Khan Zand, only to be defeated by Agha Mohammad Khan. Ali-Morad Khan died on 11 February 1785. When Agha Mohammad Khan heard of his death, he went to Tehran to try to capture it. When he reached the city, the inhabitants quickly closed the gates, and told him that they would open the gate only for the king of Iran, who according to them was
Jafar Khan Zand, who had succeeded Ali-Morad Khan. Thus Agha Mohammad Khan had to defeat Jafar Khan to be recognized as the king of Iran. He thereafter quickly marched towards Isfahan. Jafar Khan sent men to stop his advance towards the city, but they withdrew at
Qom without putting up any resistance. Jafar Khan then sent an even larger Zand army towards Agha Mohammad Khan, who defeated the army near
Kashan. Jafar Khan then fled to Shiraz. Agha Mohammad arrived at Isfahan on 2 May, where he discovered what was left of the Zand treasure and Jafar Khan's harem. The Qajar troops then looted the city. During the summer of 1785, Agha Mohammad Khan made the city his headquarters for his expeditions in Persian Iraq. He left Isfahan on 7 July on a campaign in which he managed to bring the
Bakhtiari chieftains under his suzerainty. He then left for Tehran on 2 September, appointing a former Zand commander to govern. When he arrived at Tehran, the town finally submitted to him. At the same time, his men captured
Hamadan and forced many
Kurdish and Turkic chieftains to submit to Qajar rule. On 12 March 1786, Agha Mohammad Khan made Tehran his capital. By then the city had a population of 15,000–30,000 people. It appears that during this period, Agha Mohammad Khan saw himself as the king of Iran, although he avoided using the title "
shah". Some time later, while Agha Mohammad Khan Qajar was campaigning against the Bakhtiaris, Jafar Khan quickly marched towards Isfahan and re-captured it (although the citadel of Tabrak held out for four months). He then sent troops towards Kashan and Qom, while he marched towards Hamadan in early January 1786. He was, however, defeated by local tribal chieftains, among them Khosrow Khan and Mohammad Hosayn Khan Qaragozlu. Jafar Khan then withdrew to Isfahan to deal with a rebellion by the chiefs of Jandaq, who marched towards the city. The chiefs were defeated and submitted to Jafar Khan. When Agha Mohammad Khan heard about the Zand invasion of Isfahan and its surroundings, he quickly moved towards the city, which made Jafar Khan retreat to Shiraz once again. Agha Mohammad Khan then appointed Jafar Qoli Khan as the city's governor. However, the governor of Zanjan revolted shortly afterward, which forced Agha Mohammad Khan to go back north, where he suppressed the latter's revolt and pardoned him.
Second invasion of Gilan Agha Mohammad Khan now had to focus on Gilan because Hedayat-Allah Khan had returned to the province (allegedly with Russian help) since the Qajar invasion of the province in 1782. In Agha Mohammad Khan's eyes, the whole Caspian coast was under threat by Hedayat-Allah and the Russians. Agha Mohammad Khan and his men easily managed to enter Gilan. While he was marching towards Rasht, he was joined by a local ruler named Mehdi Beg Khalatbari and other people. Furthermore, the Russian consul in Gilan betrayed Hedayat-Allah by providing weapons to Agha Mohammad Khan. Hedayat-Allah once again tried to flee to Shirvan, but was captured by men sent by a local ruler named Agha Ali Shafti (or another local ruler according to some sources), who killed him to avenge the slaughter of his family a few years earlier. Gilan was now completely under Qajar rule. Besides the conquest of Gilan, the second most valuable thing for Agha Mohammad Khan was Hedayat-Allah's treasure.
Second war with Jafar Khan Zand and enthronement Some time later a local ruler named Amir Mohammad Khan, who with another local ruler named Taqi Khan (the ruler of
Yazd), had recently defeated Jafar Khan and seized many riches, invaded Qajar territory, and marched towards Isfahan. Jafar Qoli Khan, who was still the governor of Isfahan, left the city before Taqi Khan could reach it and defeated the latter. Agha Mohammad Khan then went southwards once again. He met Jafar Qoli Khan at Isfahan in 1788, and after some time, made Taqi Khan accept Qajar suzerainty, and thereafter punished some
Qashqai tribes, who fled into the mountains. Agha Mohammad Khan then approached Shiraz, where he hoped to bait Jafar Khan out of the city, which was strongly fortified, making it very hard to besiege. Unfortunately for him, Jafar Khan remained in the city. Agha Mohammad Khan returned to Isfahan, where he appointed his brother Ali Qoli as its governor, succeeding Jafar Qoli Khan. He then left for Tehran. With Agha Mohammad Khan once again in the north, in autumn Jafar Khan began raising an army to prepare another attack against Isfahan and its surroundings. Jafar left Shiraz on 20 September and marched towards Isfahan. When Ali Qoli learned of it he sent a group of tribesmen to Qumishah, a city south of Isfahan. However, Jafar Khan easily defeated them. Ali Qoli thereafter retreated to Kashan. Jafar Khan was then able to occupy Isfahan on 20 October. Agha Mohammad Khan, learning of this, marched rapidly towards Isfahan, which led Jafar Khan withdraw to Shiraz once again and reached the city on 30 November. Agha Mohammad Khan returned to Tehran rather than attacking Shiraz again. Jafar Khan was murdered on 23 January 1789, which started a four-month civil war between several Zand princes who fought for succession to the throne. In May Jafar Khan's son
Lotf Ali Khan emerged the victor in this civil war. Lotf Ali Khan fled to Bushehr and managed to recruit the local chiefs of
Dashestan to his side. Lotf Ali was able to march against
Seyd Morad Khan on 22 April and enter Shiraz on 8 May. It was also during this period that Agha Mohammad Khan was enthroned (however still not crowned) and named his nephew Baba Khan (who would later be known as
Fath-Ali Shah Qajar) as his heir. Thus 1789 is marked as the start of his reign. ==Reign (1789–1797)==