The Principality of Herat (Persian: شاهزادهنشین هرات), the Emirate of Herat (Persian: امارت هرات), the Herat Khanate (Persian: خانات هرات) or simply Herat (Persian: هرات) was a state in Afghanistan from 1793 to 1863, and one of the 3 main khanates in 19th century Afghanistan (the others being the Khanates of Kabul and Qandahar).
In 1793, Timur Shah Durrani died and Mahmud Shah took control of Herat, becoming independent. In 1801, the principality was revived by Firuz al-Din Mirza. Herat was prosperous under his reign in spite of multiple Iranian invasions. In 1818, Mahmud and later Kamran Shah took over, attempting to keep the region stable as a buffer between the Barakzais and Qajars. However, the region was devastated by constant infighting and Iranian invasions.
The Iranian invasion of 1837 weakened the principality, eventually allowing Yar Mohammad Khan Alakozai to overthrow the last ruler, Kamran Shah Durrani, in 1842, and expand the principality's borders towards the Chahar Wilayat, Aimaq territory, and Lash-Joveyn. With his death in 1851 the principality began to decline due to a series of incompetent rulers as well as a civil war and an Iranian invasion in 1856.
The weakening of the principality allowed the Barakzais to intervene and besiege Herat. Ultimately they were able to capture the city on May 27, 1863, ending Herat's existence as an independent state.
When Timur Shah died on May 18 or May 21, 1793, Afghanistan fell into civil war. Timur Shah had 25 sons. 5 of those would become contenders for power in the following years. Zaman Shah was to be the successor of Timur Shah and was crowned on May 23. However, two of Zaman Shah's relatives would oppose his ascension to the throne. Humayun Mirza (the governor of Qandahar) opposed Zaman Shah's claim to the throne and rebelled upon receiving news of Timur Shah's death. In addition to this, Mahmud Mirza rebelled in Herat and minted coins in the name of the dead Timur Shah. On June 19, Zaman Shah marched out of Kabul headed for Qandahar.