The Afghan Civil War (1793–1824) was a dynastic civil war and a period of internal conflict within the Durrani Empire following Timur Shah Durrani's death, where power was contested among his sons after the ascension of Zaman Shah Durrani in 1793. This conflict ultimately ended with the deposition of the last Durrani ruler Ayub Shah Durrani by the Barakzais in early 1824.

Zaman Shah would be faced with criticism by his brothers who would not recognize his succession to the throne, in which Timur Shah Durrani's successors governed so ineptly during a period of profound unrest that within years of his death, the Durrani Empire was embroiled in civil war. By 1818, the Durrani Empire controlled little more than Kabul and its surrounding territory within a 160-kilometer radius. Much of the territory conquered by Ahmad Shah Durrani fell to others in this half century.

Background

Founding of the Durrani Empire The Durrani Empire was founded by Ahmad Khan Abdali in July 1747, the year that marked the definitive appearance of an Afghan political entity independent of both the Persian and Mughal empires. A jirga was concluded in the gathering site of Sher-i Surkh in Old Kandahar, with Ahmad Khan being selected as the new leader of the Afghans after Sabir Shah placed wheat or barley sheaves in Ahmad Khan's turban. Ahmad Shah then bore the epithet "King, Pearl of the Pearls", thus the Durrani dynasty was founded. Ahmad Khan Abdali was then known as "Ahmad Shah Durrani", after re-naming the Abdali tribe into "Durrani", based on his bestowed title, which was the Persian word for "pearl".

However, Ahmad Shah's accession was disputed by Hajji Jamal Khan, chief of the Barakzai tribe. The Barakzais were the most powerful clan of the Abdalis centered in the Kandahar and Helmand regions. The dispute over accession continued until an agreement was made where Jamal Khan would submit to Ahmad Shah as king, while Ahmad Shah would appoint Jamal Khan and his descendants as viziers. Despite being younger than the other contenders, Ahmad Shah had several overriding factors in his favor. He belonged to a respectable family of political background, especially since his father Mohammad Zaman Khan was the Sultan of Herat.

Succession crisis

In Afghan society, succession crisis was a common and a violent consequence of a king's death, especially when one of the king's sons was a primary contender for the throne. It would mainly be driven by jealousy over the selected son who was honored to be a successor, and often due to the absence of an accepted system of primogeniture, which often led to fierce rivalries. Each prince would backed by different factions and tribes, to which they would continuously vie for power while creating internal strife and instability, as the sons often sought to gain the loyalty of influential tribal leaders, military commanders and other key figures.

Before his death, Ahmad Shah chose his younger son, Timur Mirza Durrani, to succeed him, passing over his eldest son, Sulaiman Mirza Durrani. The announcement led to an internal conflict between factions loyal to Sulaiman and Timur. Ahmad Shah dismissed the faction of Sulaiman, proclaiming Timur far more capable than Sulaiman. However, Timur was left as governor at Herat, allowing the faction of Sulaiman to grow their influence in the Durrani capital of Kandahar. Upon Ahmad Shah's death, the faction of Sulaiman refused the throne to Timur, and gave it to Sulaiman, triggering a short civil war. Timur emerged victorious without battle, as support for Sulaiman had dissipated, and he fled to India. Later during the reign of Timur, his brother Sikander would become the main focus of a conspiracy to succeed to the Durrani throne after a plot on Timur's life that nearly succeeded in Peshawar.

Civil war Background During this time, the Durrani Empire lost significant territory, as the Kunduz Khanate and Saighan became independent which later fell under Bukharan suzerainty, while the Khozeimeh Amirdom and the Qara Bayat Amirdom also gained independence, only to later fall under Qajar suzerainty. Even though the Sikhs have been defeated in Multan, the Durrani Empire had clear signs of being dragged into a downfall as it was ruled ineptly, the decade of prolonged sieges had drained the empire's financial resources.

Battle of Kandahar Not abiding by the elections that took place in Kabul, Durrani tribal leaders had rebelled in Kandahar and installed Humayun Shah Durrani as king, while getting Mahmud Mirza and Firuz Mirza in Herat to submit to him. Zaman Shah sent his full brother Shuja Mirza Durrani, alongside with Payandah Khan to deal with this rebellion, and defeated Humayun Shah and the Durrani rebels near Qalat. When Mahmud Mirza and Firuz Mirza heard of the fall of Kandahar, they shifted their allegiance to Zaman Shah, who honored his pledge to his father and allowed them to remain governors of Herat.

Zaman Shah, wanting to further secure his throne from the growing popularity of Mahmud Mirza in Herat and older brother Humayun Shah in Kandahar, wanted to mobilize his army to march on Kandahar to prevent them uniting against his rule. Humayun Shah, disregarded the advice to stay in defense within Kandahar's great walls and wait for Mahmud Shah's reinforcements to arrive from Herat, and marched out to meet Zaman Shah's army and was defeated at Qalat. Humayun Shah was forced to flee to Balochistan, being placed under house arrest by Nasir Khan Ahmadzai, to which he later escaped. With his victory, Zaman Shah secured Kandahar.

Second Battle of Kandahar Zaman Shah marched to the winter capital of Peshawar, and heard the news of his brother Humayun Shah seizing Kandahar with the assistance of the Talpurs of Sindh. He turned from Peshawar to meet him at Kandahar, to which Humayun was forced to flee again after being betrayed by the Afghans in Kandahar, but this time to Sindh. He then attempted to escape to Herat in the domain of his brother Mahmud Shah, to which he was captured with a detachment of horses and ordered by Zaman Shah to be blinded, making sure Kandahar wouldn't be under threat from him once again.

Persian invasion As a result, Zaman Shah was forced to withdraw from his invasion of India and prepare an army to invade Mashhad. However, due to Agha Mohammad Khan Qajar's assassination on 17 June 1797, Nader Mirza Afshar had resumed control and restored his allegiance to the Durrani throne.

Siege of Herat Zaman Shah, seeing Mahmud Shah as a future threat if the Persians had ever invaded again, broke the reconciliation and decided to try and retake Herat and strip Mahmud of his administrative titles. Zaman Shah then met Mahmud at a battle near Grishk, and defeated Mahmud Shah, which allowed him to besiege Herat. The city held out and eventually, Mahmud Shah's mother had broken a deal between the two brothers. The terms of which would be Zaman Shah's kingship would be recognized in exchange for keeping his governorship of Herat. Kamran Mirza Durrani, the son of Mahmud Shah, noticing Zaman Shah leaving back to Helmand, led the army of the city in pursuit. Once Kamran Mirza had left, Qilij Khan, the governor of Herat in place for Kamran, had led a rebellion and opened the gates to Zaman Shah. Mahmud Shah and Kamran had then fled to Tehran.

First Bukharan invasion Taking advantage of the civil war, the Bukharans led by Shah Murad occupied Aqcha after defeating Mohammad Khan Qizilbash, imprisoning him and other Qizilbash soldiers. The surviving soldiers retreated to the Balkh citadel and were then chased by the Bukharans, but couldn't take the citadel within the four-month siege, especially after executing the imprisoned Qizilbash commander while sending multiple failed threats. Eventually, Shah Murad admitted defeat and sent envoys to Kabul to negotiate a truce, which led the Bukharans to withdraw back across the Oxus.

Return of Mahmud Shah The sons of Payandah Khan then fled to Persia and pledged allegiance to Mahmud Shah Durrani which led to the latter's rise in popularity after a long time and an era of retiring. Mahmud Shah's army then marched to Farah while he led speeches and rallies against Zaman Shah, announcing his intention to become king while exposing the tyrannies of Zaman Shah and Fath Allah Khan. With this, Mahmud Shah gained the large support of the Barakzai and Popalzai tribes while he marched on Kandahar.

Mahmud Shah had begun sieging the city, and the city garrison held fierce for 42 days. However, on the 43rd day, Fateh Ali Khan had managed to gain the support of two additional tribal chiefs in Kandahar, and the city finally fell to Mahmud Shah's forces. Zaman Shah, unaware of what had happened at Kandahar, had been focused on Persia's movements. After receiving intelligence, he shifted his focus on what the Barakzais might do next in Kabul. Zaman Shah left most of his forces with his brother Shuja Mirza Durrani in Peshawar.

Deposition of Zaman Shah Mahmud Shah had led efforts to imprison Zaman Shah and sent the latter multiple threats. Zaman Shah, feeling helpless, resigned to his fate and hid his jewels including the Koh-i-Noor, Daria-i-Noor and the Timur Ruby. Zaman Shah was then imprisoned and blinded by Asad Khan, a surgeon ordered by Mahmud Shah. Zaman Shah eventually escaped from Kabul and sought refuge at Rawalpindi, where he was met by Ranjit Singh, who gave him a house to stay in, but later due to his safety concerns, Ranjit Singh welcomed him to stay in Lahore, with a monthly allowance of 1,500 rupees.

Reign of Mahmud Shah Durrani Ghilji rebellion (1801–1802)

Resenting their subjugation to Durrani rule in their own domains and recalling their legacy at Isfahan, the Hotak and Tokhi tribes of the Ghilji tribal confederacy rebelled against Mahmud Shah Durrani in 1801. The internal instability within the Durrani Empire followed by the rivalry between Mahmud Shah and Shuja Shah provided an opening for the Ghilji rebels to attempt a power bid, and rapidly gained strength in Kandahar, marched toward Ghazni, and defeated its governor in open battle, but could not capture the Ghazni citadel.

1803 anti-Shia riots in Kabul

Triggered by the fall of Mashhad to the Persians in 1803, the Sunni factions of Kabul led by clerics used the loss as an advantage to target the Qizilbash, who were mainly Shia, and were always disliked by the native Afghans as they were considered "foreign". Sher Mohammad Khan Bamizai rallied Kabul’s Sunni clergy by creating an anti-Shia coalition by aligning with Sayyid Mir Ahmad Agha, known to his followers as Khwaja Khanji, head preacher of the Pul-e Khishti Mosque and custodian of the Ashiqan wa Arifan shrine.

As Mahmud Shah hid inside the Bala Hissar instead of cracking down on rioters, the anti-Shia coalition led by Sher Mohammad Khan and Khwaja Khanji pulled in massive tribal reinforcements that launched repetitive attacks while ringing Chindawol, which included several thousand mobs, 20,000 men from Kohistan, Logar, and Tagab, as well as several thousand Ghilji and Safi tribesmen. The Qizilbash Army's fortified mahallah had thick walls, elevated firing positions, and arms stockpiled. Well-aimed volleys cut down hundreds of attackers. The besiegers pushed artillery and sharpshooters onto the Sher Darwaza heights overlooking the quarter, turning the fight into a grinding siege, as the clerics mobilized more fighters and launched diversionary attacks against both Chindawol and the Bala Hissar. Fateh Ali Khan, returning from the south with 10,000 Hazara troops, finally broke the stalemate by backing the Qizilbash defenders, scattering the mobs and forcing the tribal levies to retreat. The standoff dragged on for nearly a month, with over 400 people dying.