From 1818 until Dost Mohammad's ascendancy in 1826, chaos reigned in the domains of Ahmad Shah Durrani's empire as various sons of Painda Khan struggled for supremacy. Afghanistan ceased to exist as a single nation, disintegrating for a brief time into a fragmented collection of small units, each ruled by a different Durrani (Pashtun from the Abdali group of clans) leader. About 32,000 Afghanis perished in the chaos.
Dost Mohammad achieved prominence among his brothers through clever use of the support of his mother's Qizilbash tribesmen and his own youthful apprenticeship under his older brother, Fateh Khan. Advancing from Kashmir in 1818, Dost Mohammad took Peshawar and Kabul and drove Shah Mahmud and Kamran from all their possessions except Herat, where they maintained a precarious footing for a few years. Ghazna, Kabul, and Jalalabad fell to Dost Mohammad. He assumed the title of amir in 1826 at Kabul and Dost Mohammad established the Barakzay (or Mohammadzai) dynasty. Meanwhile, Balkh was seized by the ruler of Bukhara; the trans-Indus Afghan districts were occupied by the Sikhs; and the outlying provinces of Sind and Baluchistan assumed independence.