Another early Pashtun nationalist was the 17th-century "warrior-poet" Khushal Khan Khattak, who was imprisoned by the Mughal emperor Aurangzeb for trying to incite the Pashtuns to rebel against the rule of the Mughals.[citation needed] However, despite sharing a common language and believing in a common ancestry, the Pashtuns first achieved unity in the 18th century after being under foreign rule for many centuries. The eastern parts of Pashtunistan was ruled by the Mughal Empire, while the western parts were ruled by the Persian Safavids as their easternmost provinces.[citation needed] During the early 18th century, Pashtun tribes led by Mirwais Hotak successfully revolted against the Safavids in the city of Kandahar. In a chain of events, he declared Loy Kandahar and other parts of what is now southern Afghanistan independent.[citation needed] By 1738 the Mughal Empire had been defeated and their capital sacked and looted by forces of a new Iranian ruler Nader Shah Afshar. Besides Persian, Turkmen, and Caucasian forces, Nader was also accompanied by the young Ahmad Shah Durrani and 4,000 well-trained Pashtun troops.[citation needed]
After the death of Nader Shah in 1747 and the disintegration of his massive empire, Ahmad Shah Durrani established Durrani Empire, which included most of present-day Afghanistan and Pakistan, among other regions.[3] The famous couplet by Ahmad Shah Durrani describes the association the people have with the regional city of Kandahar:[citation needed]
Da Dilī takht zə hērawəma chē rāyād kṛəm, zəmā da ṣ̌hkuləi Paṣ̌htūnkhwā da ghrō sarūna. Translation: "I forget the throne of Delhi when I recall, the mountain peaks of my beautiful Pashtunkhwa."
The last Afghan Empire was established in 1747 and united different tribes as well as many other ethnic groups.[citation needed] Parts of the Pashtunistan region around Peshawar was invaded by Ranjit Singh and his Sikh army in the early part of the 19th century, but a few years later they were defeated by the British, which reached the Pashtunistan region from the east.[citation needed]
After the establishment of Pakistan, Bacha Khan pledged his allegiance to the newly independent country in the Constituent Assembly of Pakistan, and said that he would continue to work for greater autonomy within the framework of the state of Pakistan. However, Mirzali Khan and his followers refused to recognize Pakistan and continued their guerrilla war against the new state's government from their base in Gurwek, Waziristan, receiving support from the Afghan government, but they did not receive much success. [9]
Note: Forms of nationalism based primarily on ethnic groups are listed above. This does not imply that all nationalists with a given ethnicity subscribe to that form of ethnic nationalism.