History of Afghanistan
Islamic conquest
The Islamic conquest of Afghanistan (642–870) began after the Islamic conquest of Persia, when Arab Muslims defeated the Persian Sassanians. The Arabs then began to move towards the lands east of Persia and in 642 captured the city, Herat.
The invasion of Persia was completed five years after the death of the Islamic prophet Muhammad, and all of the Persian territories came under Arab Control.
During the 7th century, Arab armies made their way into the region of Afghanistan with the new religion Islam. At this time the area that is currently Afghanistan had a multi-religious population consisting of Buddhists, Zoroastrians, Hindus, Jews, as well as others.
Shahi
The area had been under the rule of the Buddhist and then Hindu dynasty called the Shahis since the 5th century AD. The Arabs were unable to succeed in converting the population because of constant revolts from the mountain tribes in the Afghan area, which may have been recognized as Pashtuns. The Hindushahi were defeated in the early part of the 10th century by Mahmud of Ghazna (998-1030) who ruled between 998 and 1030. He expelled the Hindus from Gandhara.
Earlier in 870, Yaqub bin Laith as-Saffar, a local ruler from the Saffarid dynasty of Zaranj, conquered most of present-day Afghanistan in the name of Islam.
From the 8th century to the 9th century, many inhabitants of what is present-day Afghanistan, Pakistan, and areas of northern India were converted to Sunni Islam. It is surmised from the writings of Al Biruni that some Pashtuns living in Pakhtunkhwa (present-day western Pakistan) had not been completely converted. Al Biruni, writing in Tarikh al Hind, also alludes to the Pashtun tribes of Pakhtunkhwa as being neither Muslim nor Hindu, but simply Afghans which may mean that they practiced Pashtunwali.
Ghaznavid and Ghorid rule
The first great Islamic empire of the region came out as The Ghaznavid Empire, where warriors forged an empire that took over many areas of Iran and Central Asia and conducted many successful raids into South Asia.
Their military incursions assured the domination of Sunni Islam in what is now Afghanistan, Pakistan, and parts of India. The most knowned of the dynasty's rulers was Mahmud, who got control over the areas south of the Amu Darya then carried out devastating raids into India - looting Hindu temples in his wake. Mahmud built a great capital at Ghazni (modern-day Afghanistan), founded universities, and patronized scholars. By the time of his death, Mahmud ruled empire that stretched from Kurdistan to the entire Hindu Kush region as far east as the Punjab as well as territories far north of the Amu Darya. However, as occurred so often in this region, the demise in 1030 of this military genius who had expanded the empire to its farthest reaches was the death knell of the dynasty itself. The rulers of the Ghorid Empire of Ghor in modern-day Afghanistan, captured and burned Ghazni in 1149, just as the Ghaznavids had once conquered Ghor.
The Ghorids controlled most of what is now Afghanistan, eastern Iran, Pakistan, and northern India around 1186, while parts of central and western Iran were ruled by the Selcuk Turks. From 1200 to 1205 some of the Ghorid lands were conquered by the Shah of the Khwarezmid Empire, whose empire would, in turn, be defeated by the Mongols in 1220.
Mongol invasion and Timurid rule 1220-1506
Followings years of conquest in China and Central Asia, the Mongol Empire had emerged as a major world power of its day and attempted to co-exist with some of their neighbors including the empire of the Khwarezmia Shah and sent emissaries to establish diplomatic and trading links. As either a bluff to dissuade the Mongols from aggression or as simply a haughty sign of disrespect, the Khwarezmia Shah Ala ad-Din Muhammad II had the diplomats executed and sent their heads back to the Mongols and this prompted a military confrontation.
In 1220, the Islamic lands of Central Asia were overrun by the armies of the Mongol invader Genghis Khan (ca. 1155-1227), who laid waste to many cities and settlements and created an empire that stretched from China to the Caucasus. The Mongols under Genghis Khan responded with great severity to the insults they had taken from Muhammad II and took out their revenge against the inhabitants of Khwarezmia including, for example, exterminating every human being in the cities of Herat and Balkh. This devastation had severe consequences for the natives of Afghanistan as the destruction caused by the Mongols depopulated many of the major cities and caused much of the population to revert to an agrarian rural society.
Thus, Afghanistan became dominated by cattle breeding tribes who also specialized in horseback riding. Genghis Khan failed to extinguish Islam in Central Asia as the religion continued to define many local inhabitants culturally. In fact, by the end of the 13th century, Genghis Khan's descendants had themselves become Muslims (many speculate that the Hazaras of Afghanistan are in fact the descendants of Genghis Khan and his Mongol hordes and even the title of 'khan' became a not so uncommon name adopted by many local inhabitants. From the death of Genghis Khan in 1227 until the rise of Timur Lenk in the 1380s, Central Asia went through a period of fragmentation.
A product of both Turkish and Mongol descent, Timur claimed Genghis Khan as an ancestor. From his capital of Samarkand, Timur created an empire that, by the late fourteenth century, extended from northern India to eastern Turkey. The turn of the sixteenth century brought an end to the Timurid Empire when another Central Asian ruler of Turkic-Mongol extraction, Muhammad Shaybani, overwhelmed the weakened Timurid ruler in Herat. Shaybani (also a descendant of Genghis Khan) and his successors ruled the area around the Amu Darya for about a century, while to the south and west of what is now Afghanistan two powerful dynasties began to compete for influence.
Mughal-Safavid rivalry, ca. 1500-1747
Early in the sixteenth century, Babur, who claimed descent from Timur on his father's side and from Genghis Khan on his mother's, was driven out of his father's kingdom in the Ferghana Valley (todays Uzbekistan, Tajikistan and Kyrgyzstan) by the Shaybani Uzbeks. After several unsuccessful attempts to reconquer Ferghana and Samarkand, Babur crossed the Amu Darya and captured Kabul from the last of its Mongol rulers in 1504. In his invasion of Delhi Sultanate of India in 1526, Babur's army of 12,000 defeated a less mobile force of 100,000 at the First Battle of Panipat, about 45 kilometers northwest of Delhi. The Delhi Sultanate was itself ruled by expatriate Afghan/Pashtun rulers, the Lodhi dynasty.
Although Mughal rule technically lasted in parts of Afghanistan until the early 18th century, it came under constant challenge from local Pashtun tribesmen. The Mughals originally had come from Central Asia, but once they had taken India, the area that is now southeastern Afghanistan and western Pakistan. Indeed, during the 16th and 17th centuries, much of Afghanistan was contested between the Mughals of India and the Safavids of Iran.
The Safavids had held Herat and much of western and northern Afghanistan during the same time period that the Mughals controlled Kabul, Kandahar, and Peshawar. The strategically important Kabul-Kandahar areas was the competition between the Mughals and the Safavids, and Kandahar itself changed hands several times during the sixteenth and seventeenth centuries.
As the area around Kandahar changed hands back and forth between the two great empires on either side, the local Pashtun tribes exploited the situation to their advantage by extracting concessions from both sides. By the middle of the 17th century, the Mughals had abandoned the Hindu Kush north of Kabul to the Uzbeks, and in 1622 they lost Kandahar to the Safavids for the 3d and final time.
Toward the end of the 17th century, as the power of the Safavids run out. Early in the 18th century, a clan of the Ghilzai Pashtuns, later known as the Hotaki dynasty, overturned Safavid rule in Kandahar by 1708, and subsequently took over and ruled most of Safavid Persia and Afghanistan from 1722 until 1736. The Ghilzai Pashtuns managed to briefly hold the Safavid capital of Isfahan, and two members of this tribe ascended the throne before the Ghilzai were evicted from Iran by the Turko-Iranian conqueror, Nadir Shah, who became known by some in the West as the "Persian Napoleon."
Nadir Shah conquered Kandahar and Kabul in 1738 along with his Mughal army in India, plundering Delhi, and massacring thousands of its people. He returned home with treasures, including the Peacock Throne, which thereafter served as a symbol of Iranian imperial might. Nadir Shah, as a Sunni Muslim, had surrounded himself with other Sunnis, most notably those of Turkic and Pashtun background. One notable military officer was Ahmad Shah Durrani, an ethnic Pashtun who was gonna shape the modern history of Afghanistan following the end of Nadir Shah's reign in 1747.