In 1738, Nader Shah and his forces captured Kandahar, the last Hotak stronghold, from Shah Hussain Hotak, at which point the incarcerated 16-year-old Ahmad Shah Durrani was freed and made the commander of an Afghan regiment. Soon after the Persian and Afghan forces invaded India. By 1747, the Afghans chose Durrani as their head of state. Durrani and his Afghan army conquered much of present-day Afghanistan, Pakistan, the Khorasan and Kohistan provinces of Iran, and Delhi in India. He defeated the Indian Maratha Empire, and one of his biggest victories was the 1761 Battle of Panipat.
Ahmad Shah Durrani, founder of the last Afghan empire and viewed as Father of the Nation
In October 1772, Durrani died of a natural cause and was buried at a site now adjacent to the Shrine of the Cloak in Kandahar. He was succeeded by his son, Timur Shah, who transferred the capital of Afghanistan from Kandahar to Kabul in 1776. After Timur's death in 1793, the Durrani throne passed down to his son Zaman Shah, followed by Mahmud Shah, Shuja Shah and others.
The Afghan Empire was under threat in the early 19th century by the Persians in the west and the British-backed Sikhs in the east. Fateh Khan, leader of the Barakzai tribe, had installed 21 of his brothers in positions of power throughout the empire. After his death, they rebelled and divided up the provinces of the empire between themselves. During this turbulent period, Afghanistan had many temporary rulers until Dost Mohammad Khan declared himself emir in 1826. The Punjab region was lost to Ranjit Singh, who invaded Khyber Pakhtunkhwa and in 1834 captured the city of Peshawar. In 1837, during the Battle of Jamrud near the Khyber Pass, Akbar Khan and the Afghan army killed Sikh Commander Hari Singh Nalwa. By this time the British were advancing from the east and the first major conflict during the "Great Game" was initiated.
(source)