Hotak dynasty

The Hotak dynasty was an Afghan monarchy founded by Ghilji Pashtuns that briefly ruled portions of Iran and Afghanistan during the 1720s. It was established in April 1709 by Mirwais Hotak, who led a successful rebellion against the declining Persian Safavid empire in the region of Loy Kandahar ("Greater Kandahar") in what is now southern Afghanistan.

In 1715, Mirwais died of natural causes and his brother Abdul Aziz succeeded him. He did not reign long as he was killed by his nephew Mahmud, who deposed the Safavid Shah and proclaimed his own rule over Iran. Mahmud in turn was succeeded by his cousin Ashraf following a palace coup in 1725. Ashraf also did not retain his throne for long, as the Iranian conqueror Nader-Qoli Beg (later Shah), leading the resurgent Safavid banner, defeated him at the Battle of Damghan of 1729. Ashraf Hotak was banished to what is now southern Afghanistan, confining Hotak rule to a small corner of their former empire. In 1738, Hotak rule ended when Nader Shah defeated Ashraf's successor Hussain Hotak after a lengthy siege of Kandahar. Subsequently, Nader Shah began re-establishing Iranian suzerainty over regions lost decades before to Iran's archrivals—the Ottoman and Russian Empires.

Decline of the Safavids
The Shi'a Safavids ruled Loy Kandahar as their easternmost territory from the 16th century until the early 18th century. At the same time, the native Afghan tribes living in the area were Sunni Muslims. Immediately to the east was the powerful Sunni Mughal Empire, who occasionally fought wars with the powerful Safavids over the territory of southern Afghanistan. The Khanate of Bukhara controlled the area to the north at the same time. By the late 17th century, the Safavids started to decline. With the death of Shah Abbas in 1629, succeeding Safavid rulers were less effective and caused the empire to decline. On 29 July 1694, Shah Suleiman died and Sultan Husayn took the throne. Under his reign the problems worsened. Husayn barely left the palace during his reign, not an uncommon aspect of many later Safavid Shahs. Later Safavid rulers were immobile and their courts were riddled with factionalism unlike their more mobile ancestors who spent more time on campaigns and had smaller courts. The government was weak and the army was ineffective. This power vacuum allowed tribal groups like the Turkmen, Baluch, Arabs, Kurds, Dagestanis, and Afghans to constantly raid frontier provinces.

Governorship of Gurgin Khan
In 1704, the Safavid Shah Husayn appointed his Georgian subject and king of Kartli George XI (Gurgīn Khān), a convert to Islam, as the governor of Kandahar. In early May 1704, George marched from Kerman and after a seven-week march; he crushed disturbances going on in the province at the time. He soon encountered Mirwais Hotak, the mayor (kalantar) of Kandahar and one of the richest and most influential people among the Ghilzais. At first Mirwais had good relations with the Georgians but it began to sour when Mirwais was removed from his position as mayor in 1706 and replaced by Alam Shah Afghan.

The Georgians were hated throughout the province. They ruled with brutality towards the local population. This would encourage the Ghilzais to revolt against Safavid rule, and Mirwais was involved in one of these revolts. Gurgin Khan found out and sent Mirwais to Isfahan. While there, he saw the weakness of the Safavid court and complained about the brutality of Gurgin Khan. He turned the shah and his court against Gurgin Khan, and then went on a pilgrimage to Mecca. He managed to get a fatwa from the religious authorities approving Mirwais's plan to overthrow tyrannical Safavid rule. In the summer of 1708 or January 1709 he returned to Kandahar and waited for the opportunity to kill Gurgin Khan.

Rebellion
That opportunity came in April 1709. The Kakar tribe refused to pay taxes and revolted, so Gurgin Khan and his men went out to campaign against them. Protected by the Ghaznavid Nasher Khans, Mirwais and his men ambushed Gurgin Khan on April 21 and killed him. They expelled the Georgian garrison from Kandahar and the surviving Georgians fled to Gereshk and waited. When the Safavid court heard of this, they sent Kaikhosro Khan with 12,000 men to recapture Kandahar. He left Isfahan for Qandahar in November 1709, and were aided by members of the Abdali tribe. The army progressed slowly as the court was unwilling to help much, and they arrived at Farah in April–May or November 1710. In the summer of 1711 Kaikhosro marched to Kandahar and besieged it. The Ghilzais sued for peace but Kaikhosro refused to accept it, so they kept fighting. The Baluchis frequently harassed the Georgians and forced them to retreat on October 26. The defenders of Kandahar emerged and pursued the Georgians, resulting in the death of Kaikhosro. Another Persian army was sent to Kandahar in 1712 but they never made it there as their commander died in Herat, leaving the Hotaks to their own devices. With this, Mirwais was able to extend his control over the entire province of Kandahar. After his peaceful passing in November 1715 from natural causes, his brother Abdul Aziz succeeded him; the latter was murdered later by Mirwais' son Mahmud after having only ruled for eighteen months.

Invasion of Iran
In 1720, Mahmud's Afghan forces crossed the deserts of Sistan and captured Kerman. He planned to conquer the Persian capital, Isfahan. After defeating the Persian army at the Battle of Gulnabad on March 8, 1722, he proceeded to besiege Isfahan. The siege lasted about six months and the people of Isfahan were in such a state of hunger that they were forced to eat rats and dogs. On October 23, 1722, Sultan Husayn abdicated and acknowledged Mahmud as the new Shah of Persia. For the next seven years until 1729, the Hotaks were the de facto rulers of most of Persia, and the southern areas of Afghanistan remained under their control until 1738.

The Hotak dynasty was a troubled and violent one from the very start as an internecine conflict made it difficult to establish permanent control. The majority of Persians rejected the leaders as usurpers, and the dynasty lived under great turmoil due to bloody succession feuds that made their hold on power tenuous. After the massacre of thousands of civilians in Isfahan – including more than three thousand religious scholars, nobles, and members of the Safavid family – the Hotak dynasty was eventually removed from power in Persia.

Decline
Ashraf Hotak took over the monarchy following Shah Mahmud's death in 1725. He had to deal with a Safavid loyalist movement in the south led by Sayyed Ahmad, who had taken over much of Fars, Hormozgan, and Kerman. Ashraf's army was defeated in the October 1729 at the Battle of Damghan by Nader Shah Afshar, an Iranian soldier of fortune from the Afshar tribe, and the founder of the Afsharid dynasty that replaced the Safavids in Persia. Nader Shah had driven out and banished the remaining Ghilji forces from Persia and began enlisting some of the Abdali Afghans of Farah and Kandahar in his military. Nader Shah's forces, among them Ahmad Shah Abdali and his 4,000 Abdali troops, went on to conquer Kandahar in 1738. They besieged and destroyed the last Hotak seat of power, which was held by Hussain Hotak (or Shah Hussain). Nader Shah then built a new town nearby, named "Naderabad" after himself. The Abdalis were then restored to the general area of Kandahar, with the Ghiljis being pushed back to their former stronghold of Kalat-i Ghilji. This arrangement lasts to the present day.