Herat campaign of 1862–1863

The Herat campaign of 1862–1863 was a conflict between the Principality of Herat and the Emirate of Afghanistan, from March 1862, when Sultan Jan captured Farah from the Muhammadzai Emirs and continued through the 10-month long siege of Herat, ending on May 27, 1863, when the city fell to the Amir-i Kabir, thus completing the unification of Afghanistan.

Herat
Herat had been an independent state since 1818, after the Sadozais were expelled from Kabul and Kandahar by the Barakzais. It had been a bone of contention between the Barakzais and Qajars for quite some time. Iran made dozens of attempts to conquer Herat (1807, 1811, 1814, 1817, 1818, 1821, 1833, 1837). Eventually in early 1842, Kamran Shah, the last reigning Sadozai ruler of Herat, was deposed and brutally murdered by his vizier, Yar Mohammad Khan Alakozai. He expanded the country towards the Chahar Wilayat, subdued the Aimaq tribes, and conquered Sistan. In 1851, Yar Mohammad Khan died after coming back from a campaign against Lash-Juwain. Twelve days after his demise, Yar Mohammad Khan's incompetent and weak son, Sa'id Mohammad Khan was put on the throne.

Sa'id Mohammad Khan was very unpopular among the people of Herat. He had to rely more and more on Iranian aid just to stay in power. The Qandahar Sardars took advantage of this to attack Herat in 1852.

Emirate of Afghanistan
After the end of the First Anglo-Afghan War in 1842, Dost Mohammad Khan was now in a position to expand his state dramatically. This was in part due to the improving relationship between Dost Mohammad Khan and the British. During his exile in Calcutta, he was treated warmly.

He took note of the technological superiority of the British and was convinced that constant wars with them would damage Afghanistan. Instead, Dost Mohammad would advocate for an alliance with the British as the only way to ensure the survival of the state. With the First and Second Anglo-Sikh Wars eliminating any threat that the volatile Sikh Empire would have had on Afghanistan, Dost Mohammad Khan was now able to freely expand his kingdom with the help of the British, realizing that he and British had common Central Asian goals.

In 1843, Dost Mohammad Khan subdued the Hazarajat (Behsud, Dai Zangi, Dai Kundi) and Bamian in the Hazarajat Campaign of 1843. The multiple tribes and states had capitalized on the British invasion as a power vacuum to become independent. In 1846, a rebellion by the Kohistani Tajiks of Tagab was suppressed and Dost Mohammad was able to consolidate his position on that traditionally rebellious area. In July 1848, he intended to send a force to conquer Balkh but the Second Anglo-Sikh War prevented this and occupied Dost Mohammad for another year. The Sikhs proposed to cede Peshawar to the Afghans (although it never became a reality) and as a result, Mohammad sent 5,000 Afghans under Mohammad Akram Khan to aid the Sikhs in the war. When the Sikhs were defeated and the British retook Peshawar, it was feared in Kabul that the British would follow up their victory by invading Afghanistan. However, this never happened and Dost Mohammad therefore invaded Balkh in the Spring of 1849.

British involvement
Dost Mohammad Khan was confident that the British would not intervene to save Herat.

Herati Conquest of Farah
Sultan Ahmad Khan sent 7,000 infantry and cavalry and 5 cannons under the command of Shahnavaz Khan to capture Farah. On March 11, 1862, Herati forces conquered the city of Farah in a battle where around 100 men on both sides were killed. Shahnavaz Khan was reckless and became intoxicated. His forces committed atrocities in the area to the point where they assaulted some of Dost Mohammad Khan's female relations. This was Sultan Ahmad Khan's biggest blunder, as it allowed Dost Mohammad Khan to have a cassus belli for an invasion of Herat. He believed that the Iranians backed Sultan Ahmad Khan's conquest of Farah, when in reality they never sanctioned such a move.

Dost Mohammad Khan's invasion
When Dost Mohammad Khan got word of the capture of Farah, he prepared for war with Sultan Ahmad Khan. The Amir left his winter quarters at Jalalabad and began plans to march towards Herat. He called up an army consisting of 26,000 infantry, 4,000 cavalry, 12 cannons, and 4 mortars. Dost Mohammad Khan left Kabul on April 18, and an advance party was led by his sons Sher 'Ali Khan, Mohammad Sharif Khan, and Mohammad 'Amin Khan. On June 9, their forces reached the town of Gereshk. On June 16 they crossed the Helmand river. On June 29 or July 6 the advance party seized Farah from Sultan Ahmad Khan's appointee, Mir Afzal Khan. Dost Mohammad Khan, who had been leading a separate army, combined forces with his sons soon after. Together the two marched on the city of Sabzawar, and engaged the forces of Shah Navaz Khan. On July 19, Sabzawar was taken by their combined forces.

Siege of Herat
On July 27, the city of Herat was surrounded by Dost Mohammad Khan. Kohzad gives August 10. The people of Herat were determined to resist Dost Mohammad Khan and his army. Despite his failing health, Sultan Ahmad Khan did not show the slightest inclination to submit. For 5 days the Mohammadzais dug trenches around Herat, and for the next 6 months night raids, tunneling, and "sundry engagements" would be commonplace. Sultan Ahmad Khan wrote to the shah, Naser al-Din Shah, for aid, but he did not want to break the 1857 treaty with the British and refused.

During the siege, Sultan Ahmad Khan relied on the support of Herat's Shi'a community and exclusively used Farsiwan and other Shi'a soldiers during the conflict. suspected Herat's Afghans of espionage and began to expel them from the city. In January 1863 Sultan Ahmad's wife, Nawab Dokhtar, died from grief.

On May 27, 1863, the city was captured.

Aftermath
The atrocities committed on the citizens of Herat by the Mohammadzais served to unite them, Shi'a and Sunni, against the Afghans.