Not much is known about the life of Ali-qoli Khan before his secession to the Afsharid throne. He was the eldest son of
Ebrahim Khan, a brother of
Nader Shah (), the founder of the
Afsharid dynasty of
Iran. Ali-qoli Khan attended the coronation of Nader Shah on 8 March 1736, where he was amongst the figures who were adjacent to the latter. In 1737, Ali-qoli Khan was given the governorship of
Mashhad, as well as married
Ketevan, daughter of the
Georgian king
Teimuraz II (). In 1740 he was also married to a daughter of
Abu al-Fayz Khan (), the ruler of the
Khanate of Bukhara, which had been recently subjugated by the Afsharids. From 1743 to 1747, Ali-qoli khan commanded Nader's troops against the
Yazidis of
Kurdistan, the
Karakalpaks and
Uzbeks of
Khwarazm and in
Sistan. He then ran in trouble with his uncle over the latter's decision to levy 100,000
tomans on him combined with Nader's suspiciousness. In April 1747, in conjunction with the rebels of Sistan, Ali-qoli khan occupied
Herat and induced the Kurds to enter into a rebellion. Nader, while marching against the insurgents, was murdered by a group of his officers, who then offered the crown to Ali-qoli. Nader Shah was soon murdered afterwards, by mutinous officers, on June 21, 1747. His death led to a power vacuum, which resulted in his vast empire being divided by various sovereigns. The eastern parts of his domain were seized by Uzbek and
Afghan sovereigns; a former Uzbek commander of Nader Shah named Muhammad Rahim Khan Manghit, deposed Abu al-Fayz Khan and became the new ruler of
Bukhara;
Ahmad Khan, the leader of the
Abdali tribe and formerly part of the Afghan cadre of Nader Shah's army, fled to the city of
Naderabad in
Kandahar. There he assumed the title of
Durr-i Durran (Pearl of Pearls) and thus changed the name of his Abdali tribe to "Durrani." Ahmad Khan (now titled Ahmad Shah) then went on conquer what had originally served as the frontier region between the Safavid and
Mughal Empire. In Mashhad, its civil governor and superintendent of the
Imam Reza Shrine,
Mir Sayyed Mohammad drove the Afghans out of the city, securing it for Nader Shah's nephew Ali-qoli Khan, who may have had a hand in his uncle's murder. The latter had accepted the assassins of Nader Shah into his service, and had received an invitation to Mashhad by Mir Sayyed Mohammad. == Reign ==