Durrani dynasty

The Durrani dynasty (د درانيانو کورنۍ) was founded in 1747 by Ahmad Shah Durrani at Kandahar, Afghanistan. He united the different Pashtun tribes and created the Durrani Empire. which at its peak included the modern-day Afghanistan, Pakistan, as well as some parts of northeastern Iran, eastern Turkmenistan, and northwestern India including the Kashmir Valley.

The Durranis were replaced by the Barakzai dynasty during the early half of the 19th century.

Ahmad Shah and his descendants were from the Sadozai subclan of Popalzai line of the Durranis (formerly known as Abdalis), making them the second Pashtun rulers of Kandahar after the Hotak dynasty. The Durranis were notable in the second half of the 18th century mainly due to the leadership of Ahmad Shah Durrani.

Start of the dynasty
Nader Shah's rule ended in June 1747 after being murdered by his Persian soldiers. In July 1747, when the chiefs of the Afghans met at a loya jirga (grand council) in Kandahar to select a new ruler for the Abdali confederation, the young 25-year-old Ahmad Khan was chosen. Despite being younger than other claimants, Ahmad Khan had several overriding factors in his favour: One of Ahmad Khan's first acts as chief was to adopt the title Padshah durr-i durrān (King, "pearl of the age" or "pearl of pearls"). The name may have been suggested, as some claim, from a dream, or as others claim, from the pearl earrings worn by the royal guard of Nadir Shah. The Abdali Pashtuns were known thereafter as the Durrani, and the name of the Abdali confederation was changed to Durrani.
 * He was a direct descendant of Asadullah Khan, patriarch of the Sadozai clan, the most prominent tribe amongst the Pashtun people at the time;
 * He was unquestionably a charismatic leader and seasoned warrior who had at his disposal a trained, mobile force of 4,000 loyal cavalrymen;
 * Not least, he possessed a substantial part of Nadir Shah's treasury, including the Koh-i-Noor diamond.

Ahmad Shah began his campaign by capturing Ghazni from the Ghilji Pashtuns, and wresting Kabul and Peshawar from Mughal-appointed governor Nasir Khan, conquering the area up to the Indus River in 1747. In 1749, the Mughal ruler was induced to cede Sindh, the Punjab region and the important trans Indus River to Ahmad Shah in order to save his capital from Afghan attack. Having thus gained substantial territories to the east without a fight, Ahmad Shah turned westward to take possession of Herat, which was ruled by Nader Shah's grandson, Shah Rukh of Persia. Herat fell to Ahmad after almost a year of siege and bloody conflict, as did Mashad (in present-day Iran). Ahmad Shah next sent an army to subdue the areas north of the Hindu Kush mountains. In short order, the powerful army brought under its control the Turkmen, Uzbek, Tajik and Hazara tribes of northern Afghanistan. Ahmad Shah invaded the remnants of the Mughal Empire a third time, and then a fourth, consolidating control over the Punjab and Kashmir regions. Then, early in 1757, he sacked Delhi, but permitted the Mughal dynasty to remain in nominal control of the city as long as the ruler acknowledged Ahmad Shah's suzerainty over Punjab, Sindh, and Kashmir. Leaving his second son Timur Shah to safeguard his interests, Ahmad Shah left Hindustan (India) to return to Afghanistan.

Alarmed by the expansion of China's Qing Dynasty up to the western border of Kazakhstan, Ahmad Shah attempted to rally neighbouring Muslim khanates and the Kazakhs to unite and attack China, ostensibly to liberate its western Muslim subjects. Ahmad Shah halted trade with Qing China and dispatched troops to Kokand. However, with his campaigns in India exhausting the state treasury, and with his troops stretched thin throughout Central Asia, Ahmad Shah lacked sufficient resources to do anything except to send envoys to Beijing for unsuccessful talks.

Forming a nation and start of struggles with warring neighbours
The Mughal power in northern India had been declining since the reign of Aurangzeb, who died in 1707; In 1751–52, Ahamdiya treaty was signed between the Marathas and Mughals, when Balaji Bajirao was the Peshwa. Through this treaty, the Marathas controlled virtually the whole of India from their capital at Pune and Mughal rule was restricted only to Delhi (the Mughals remained the nominal heads of Delhi). Marathas were now straining to expand their area of control towards the northwest of India. Ahmad Shah sacked the Mughal capital and withdrew with the booty he coveted. To counter the Afghans, Peshwa Balaji Bajirao sent Raghunathrao. He defeated the Rohillas and Afghan garrisons in Punjab and succeeded in ousting Timur Shah and his court from India and brought Lahore, Multan, Kashmir and other subahs on the Indian side of Attock under Maratha rule.

Ahmad Shah Abdali declared a war against the Marathas, and warriors from various Pashtun tribes and 25,000 Baloch warriors joined his army under the command of Khan of Kalat Mir Noori Naseer Khan Baloch. Early skirmishes were followed by victory for the Afghans and Baloch against the smaller Maratha garrisons in Northwest India and by 1759 Ahmad and his army had reached Lahore and were poised to confront the Marathas. By 1760, the Maratha groups had coalesced into a big enough army under the command of Sadashivrao Bhau. Once again, Panipat was the scene of a confrontation between two warring contenders for control of northern India. The Third Battle of Panipat (January 1761), fought between largely Muslim and largely Hindu armies was waged along a twelve-kilometre front. Despite decisively defeating the Marathas, what might have been Ahmad Shah's peaceful control of his domains was disrupted by many challenges. As far as losses are concerned, Afghans too suffered heavily in the Third Battle of Panipat. This weakened his grasp over Punjab which fell to the rising Sikh misls. There were rebellions in the north in the region of Bukhara.

The victory at Panipat was the high point of Ahmad Shah. The Durrani was the second largest Islamic empire in the world, behind the Ottoman Empire at that time. However, even prior to his death, the empire began to unravel. In 1762, Ahmad Shah crossed the passes from Afghanistan for the sixth time to subdue the Sikhs. He assaulted Lahore and, after taking their holy city of Amritsar, massacred thousands of Sikh inhabitants, destroying their revered Golden Temple. Within two years, the Sikhs rebelled again and rebuilt their holy city of Amritsar. Ahmad Shah tried several more times to subjugate the Sikhs permanently, but failed.

In early 1771, ten years after the collapse of Maratha supremacy in north India in the Third Battle of Panipat, Marathas under Mahadji Shinde recaptured Delhi and restored the Mughal Emperor Shah Alam II to the throne in 1772. Ahmad Shah also faced other rebellions in the north, and eventually he and the Uzbek Emir of Bukhara agreed that the Amu Darya would mark the division of their lands. Ahmad Shah retired to his home in the mountains east of Kandahar, where he died on 14 April 1773. He had succeeded to a remarkable degree in balancing tribal alliances and hostilities, and in directing tribal energies away from rebellion. He earned recognition as Ahmad Shah Baba, or "Father of Afghanistan."

By the time of Ahmad Shah's ascendancy, the Pashtuns included many groups whose origins were obscure; most were believed to have descended from ancient Aryan tribes. They had in common, however, their Pashto language. To the east, the Waziris and their close relatives, the Maseed, had lived in the hills of the central Sulaiman Mountains since the 14th century. By the end of the 16th century and the final Mughal invasions, tribes such as the Shinwari, Yusufzai, and Mohmand had moved from the upper Kabul River Valley into the valleys and plains west, north, and northeast of Peshawar. The Afridi had long been established in the hills and mountain ranges south of the Khyber Pass. By the end of the 18th century, the Durranis had blanketed the area west and north of Kandahar Province.

The main cause of the decline of the Durrani dynasty was the loss of thousands of battle hardened troops against the Marathas and relentless efforts of the Sikhs. Though Afghans defeated the Marathas decisively at the Third Battle of Panipat, there was a great loss of Durrani Empire's military power in the entire struggle. The Sikh misls, after suffering at the hands of the Afghans initially, took an advantage of loosening Durrani control over Punjab due to weakening of power in the struggle against Marathas, rose into rebellion and eventually united under Ranjit Singh. They were able to re-capture Amritsar (1802), Ludhiana (1806), Multan, Kashmir, Ladakh, Peshawar, the Khyber Pass and Lahore. By the time Ranjit Singh of the Sikh Empire died, the Sikhs had taken Kashmir and the whole Punjab from the Afghans.

The 1837 Battle of Jamrud became the last confrontation between the Afghans and the Sikhs. Akbar Khan led an attack on the Sikhs in which he killed Sikh Commander Hari Singh Nalwa before returning to Kabul.