The Afghan Civil War was fought from 9 June 1863 to January 1869. It began as a result of Dost Mohammad Khan's death on 9 June 1863 and the subsequent power struggles among his sons. Dost Mohammad consolidated his power in the second half of his reign within his inner family. His sons were appointed governors of provinces and effectively acted autonomous from the central government. This would inevitably lead to his sons fighting for control after his death.
Sher 'Ali Khan reached Kabul first and was enthroned as Emir. However, his half brothers Mohammad Afzal Khan (at the time serving as governor of Afghan Turkestan) and Mohammad A'zam Khan conspired together against him and planned to seize the throne for themselves. In the spring of 1864 Sher 'Ali Khan discovered the correspondence between Azam Khan and Afzal Khan and marched north against them both. A'zam Khan was defeated in Khost and fled to India, but Sher 'Ali Khan changed his mind and settled his dispute with Mohammad Afzal Khan after a battle at Bajgah in the late spring of 1864.
However, the prospect of peace was ruined when 'Abd al-Rahman Khan, the son of Mohammad Afzal Khan, made plans to overthrow Sher 'Ali Khan. Afzal was imprisoned and Rahman fled to Bukhara to escape the same fate. In 1865 Sher 'Ali Khan moved against Kandahar to defeat his rebellious uterine brother, Muhammad 'Amin Khan. Although he crushed the revolt and managed to kill Muhammad 'Amin Khan, Sher 'Ali's son and heir was also killed, which took a toll on his mental health resulting in his abdication. Mohammad Afzal Khan's forces took advantage of this to defeat Sher 'Ali Khan's forces in the spring of 1866 and take Kabul. Sher Ali Khan would continue to suffer defeat after defeat although gaining some success when the new governor of Afghan Turkestan and a son of Akbar Khan, Fayz Muhammad Khan, defected to him.
In September 1867 Fayz Mohammad Khan was defeated near Jabal Siraj, dying from a cannonball in the midst of the battle. However, shortly after this Mohammad Afzal Khan succumbed to cholera, and as a result Abdur Rahman Khan and Mohammad Azam Khan fought over the succession. This would give Sher 'Ali Khan a chance to take back the throne. He developed a plan: The local rulers of Turkestan would resist 'Abd al-Rahman Khan for as long as possible, while he would recapture Qandahar and march on Kabul. His plan worked, and in May 1868 the armies of Sher 'Ali Khan entered Kandahar in triumph while 'Abd al-Rahman Khan was stuck besieging Maimana. From there A'zam Khan's fall was rapid. His armies were routed and Sher 'Ali Khan triumphantly entered Kabul on 8 September 1868. Mohammad A'zam Khan fled to Iran and died there, while 'Abd al-Rahman Khan fled to Samarqand, living there in exile until the Second Anglo-Afghan War.
During the war the Durrani tribes of Helmand fought on the side of Sher 'Ali Khan.
Civil War
On June 9, 1863, Dost Mohammad Khan died 12 days after the capture of Herat. Just before his death, he put a turban on Sher 'Ali Khan's head, calling him the "Lion of Ali". However, Sher 'Ali Khan's brothers opposed his succession. Reportedly, even before Dost Mohammad Khan was buried Sher 'Ali Khan's younger brother Mohammad Aslam Khan planned to kill him with a pistol. Mohammad Afzal Khan prevented Aslam Khan from carrying out this assassination, but he made his own plans to prevent Sher 'Ali Khan from gaining the throne.
Sher Ali Khan spent three days in mourning the passing of his father, before being enthroned on June 12, 1863, in the Friday Mosque of Herat. A'zam Khan obtained oaths of allegiance to Sher 'Ali Khan from the people in the mosque. However, he wrote to Afzal Khan at Balkh begging him to march on Kabul and take the city before Sher 'Ali Khan arrived.
Revolt in Afghan Turkestan
Mohammad Afzal Khan opposed Sher 'Ali Khan's ascension to the throne and sought help from the local Uzbek rulers of the area. In July 1863 he promised them autonomy in exchange for supporting his march on the Afghan capital. However, he had been the governor of Afghan Turkestan for quite some time and in fact was the primary instigator in the destruction of the Uzbek khanates of the region. As a result, the local rulers rebelled and for the most part sided with Sher 'Ali Khan throughout the war.