His elder brother, the chief of the Barakzai, Fatteh Khan, took an important part in raising Mahmud Shah to the sovereignty of Afghanistan in 1800 and in restoring him to the throne in 1809. Mahmud repaid Fatteh Khan's services by having him assassinated in 1818, thus incurring the enmity of his tribe. After a bloody conflict, Mahmud was deprived of all his possessions but Herat, the rest of his dominions being divided among Fatteh Khan's brothers. Of these, Dost Mahommed received Ghazni, to which in 1826 he added Kabul, the richest of the Afghan provinces.
From the commencement of his reign he found himself involved in disputes with Ranjit Singh, the Sikh ruler of the Punjab, who used the dethroned Saduzai prince, Shuja-ul-Mulk, as his instrument. In 1834 Shuja made a last attempt to recover his kingdom. He was defeated by Dost Mahommed under the walls of Kandahar, but Ranjit Singh seized the opportunity to annex Peshawar. The recovery of this fortress became the Afghan amir's great concern.
Rejecting overtures from Russia, he endeavoured to form an alliance with England, and welcomed Alexander Burnes to Kabul in 1837. Burnes, however, was unable to prevail on the governor-general, Lord Auckland, to respond to the amir's advances. Dost Mahommed was enjoined to abandon the attempt to recover Peshawar, and to place his foreign policy under British guidance. In return he was only promised protection from Ranjit Singh, of whom he had no fear. He replied by renewing his relations with Russia, and in 1838 Lord Auckland set the British troops in motion against him.
In March 1839 the British force under Sir Willoughby Cotton advanced through the Bolan Pass, and on April 26 it reached Kandahar. Shah Shuja was proclaimed amir, and entered Kabul on August 7, while Dost Mahommed sought refuge in the wilds of the Hindu Kush. Closely followed by the British, Dost was driven to extremities, and on November 4, 1840 surrendered as a prisoner. He remained in captivity during the British occupation, during the disastrous retreat of the army of occupation in January 1842, and until the recapture of Kabul in the autumn of 1842.
He was then set at liberty, in consequence of the resolve of the British government to abandon the attempt to intervene in the internal politics of Afghanistan. On his return from Hindustan, Dost Mahommed was received in triumph at Kabul, and set himself to re-establish his authority on a firm basis. From 1846 he renewed his policy of hostility to the British and allied himself with the Sikhs. However, after the defeat of his allies at Gujarat on February 21, 1849, he abandoned his designs and led his troops back into Afghanistan. In 1850 he conquered Balkh, and in 1854 he acquired control over the southern Afghan tribes by the capture of Kandahar.
On March 30, 1855 Dost Mahommed reversed his former policy by concluding an offensive and defensive alliance with the British government. In 1857 he declared war on Persia in conjunction with the British, and in July a treaty was concluded by which the province of Herat was placed under a Barakzai prince. During the Indian Mutiny, Dost Mahommed refrained from assisting the insurgents. His later years were disturbed by troubles at Herat and in Bokhara. These he composed for a time, but in 1862 a Persian army, acting in concert with Ahmad Khan, advanced against Kandahar. The old amir called the British to his aid, and, putting himself at the head of his warriors, drove the enemy from his frontiers. On May 26 1863 he captured Herat, but on the 9th of June he died suddenly in the midst of victory, after playing a great role in the history of Central Asia for forty years. He named as his successor his son, Shere Ali-Khan.