text:
Muslim conquests of Afghanistan

The Muslim conquests of Afghanistan began during the Muslim conquest of Persia as the Arab Muslims migrated eastwards to Khorasan, Sistan and Transoxiana. Fifteen years after the battle of Nahāvand in 642 AD, they controlled all Sasanian domains except in Afghanistan. Fuller Islamization was not achieved until the period between 10th and 12th centuries under Ghaznavid and Ghurid dynasties who patronized Muslim religious institutions.

Khorasan and Sistan, where Zoroastrianism was well-established, were conquered. The Arabs had begun to move towards the lands east of Persia in the 7th century. The Muslim frontier in modern Afghanistan had become stabilized after the first century of the Lunar Hijri calendar as the relative importance of the Afghan areas diminished. From historical evidence, it appears Tokharistan (Bactria) was the only area conquered by Arabs where Buddhism heavily flourished. Balkh's final conquest was undertaken by Qutayba ibn Muslim in 705.

The eastern regions of Afghanistan were at times considered politically as parts of India. Buddhism and Hinduism held sway over the region until the Muslim conquest. Kabul and Zabulistan which housed Buddhism and other Indian religions, offered stiff resistance to the early Muslim advance. Nevertheless, the Arab Umayyads regularly claimed nominal overlordship over the Zunbils and Kabul Shahis

The expeditions of Caliph Al-Ma'mun (r. 813–833 AD) were the last by the Arabs on Kabul and Zabul. The king of Kabul was captured by him and converted to Islam. The last Zunbil was killed by Ya'qub bin al-Layth along with his former overlord Salih b. al-Nadr in 865. Meanwhile, the Hindu Shahi of Kabul were defeated under Mahmud of Ghazni. Indian soldiers were a part of the Ghaznavid army and the 14th-century Muslim scholar Ibn Battuta described the Hindu Kush as meaning "slayer of Indians", because large numbers of slaves brought from India died from its treacherous weather.

The geographer Ya'qubi states that the rulers of Bamiyan, called the Sher, converted in the late 8th century. Ya'qub is recorded as having plundered its pagan idols in 870 while a much later historian Shabankara'i claims that Alp-Tegin obtained conversion of its ruler in 962. No permanent Arab control was established in Ghur and it became Islamised after Ghaznavid raids. By the time of Bahram-Shah, Ghur was converted and politically united.

The Pashtun habitat during their conquest by Mahmud was located in the Sulaiman Mountains in the south of Afghanistan. Prior to Pashtun migration to the Kabul River valley, Tajiks formed the dominant population of Kabul, Nangarhar, Logar Valley and Laghman in east Afghanistan. The Pashtuns later began migrating westward from Sulaiman Mountains in the south, and displaced or subjugated the indigenous populations such as Tajiks, Hazaras, the Farsiwanis, Nuristanis and Pashayi people before or during 16th and 17th centuries.

Before their conversion, the Nuristanis or Kafir people of Kafiristan practiced a form of ancient Hinduism infused with locally developed accretions. The region from Nuristan to Kashmir was host to a vast number of "Kafir" cultures. They remained politically independent until being conquered and converted under Afghan Amir Abdul Rahman Khan in 1895–1896.

Arab conquests and rule

During the Muslim conquest of Persia, the Arabs were drawn eastwards from the Iraqi plains to central and eastern Persia, then to Media, into Khorasan, Sistan and Transoxania. 15 years after the Battle of Nahāvand, the Arabs controlled all Sasanian domains except the parts of Afghanistan and Makran. Nancy Dupree states that advancing Arabs carrying the religion of Islam easily took over Herat and Sistan, but the other areas often revolted and converted back to their old faiths whenever the Arab armies withdrew. The harshness of the Arab rule caused the native dynasties to revolt after the Arab power weakened like the Saffarids founded by the zealous Yaqub who conquered many cities of the region. Historian Cameron A. Petrie states that while the Arab expansion had both social and religious motives, it was their extraction of taxes from the subjugated people that invited the numerous local rebellions.

Medieval Islamic scholars divided modern-day Afghanistan into two regions - the provinces of Khorasan and Sistan. Khorasan was the eastern satrapy of the Sasanian Empire, containing Balkh and Herat. Sistan included a number of Afghan cities and regions including Ghazni, Zarang, Bost, Qandahar (also called al-Rukhkhaj or Zamindawar), Kabul, Kabulistan and Zabulistan.

Before Muslim rule, the regions of Balkh (Bactria or Tokharistan), Herat and Sistan were under Sasanian rule. Further south in Balkh region, in Bamiyan, indication of Sasanian authority diminishes, with a local dynasty apparently ruling from the late antiquity, probably Hepthalites subject to the Yabgu of Western Turks. While Herat was controlled by Sasanians, its hinterlands were controlled by northern Hepthalites who continued to rule the Ghurid mountains and river valleys. The Arab Umayyads regularly claimed nominal overlordship over the Zunbils and Kabul Shahis, and in 711 Qutayba ibn Muslim managed to force them to pay tribute. They would also be conquered by the Saffarids and Ghaznavids.

In Afghanistan, the frontier of the Islamic conquest had become more or less stationary by the end of the first century of Hijri calendar. One reason was that the relative importance of Sistan and Baluchistan had begun to diminish by the time of Mu'awiya I, when the conquests of Bactria and Transoxania were undertaken. In addition, the conquest in the eastern direction was extended to Makran and Sind, with Muslim colonies becoming established there in 711–12.

Sistan
The earlier Arabs called Sistan as Sijistan, from the Persian word Sagestan. It is a lowland region, lying round and eastwards from the Zarah lake, which includes deltas of Helmand and other rivers which drain into it. The Muslim conquest of Sistan began in 23 AH (643-644 AD) when Asim bin Amr and Abdallah ibn Amir invaded the region and besieged Zaranj. The Sistanis concluded a treaty with Muslims, mandating them to pay the kharaj.

The cash-strapped Sasanian king Yazdegerd III who had a large retinue, had fled to Kerman in 650. He had to flee from Kerman to Sistan after his arrogance angered the marzban of the place, eluding an Arab force from Basra which defeated and killed the marzban. Yazdegerd lost the support of governor of Sistan after demanding taxes from him and had to leave for Merv. It is not known whether this governor was a Sasanian prince or a local ruler at that time. The Arabs had campaigned in Sistan a few years earlier and Abdallah b. Amir had now gone in pursuit of Yazdegerd. He arrived in Kirman in 651 and sent a force under Rabi ibn Ziyad al-Harithi to Sistan.

Rabi crossed the desert between Kirman and Sistan, reaching the fortress of Zilaq which was within five farsangs of the Sistan frontier. The fort was surrendered by its dihqan. The fortress of Karkuya, whose fire temple is mentioned in the anonymously authored Tarikh-e-Sistan, along with Haysun and Nashrudh, surrendered to Rabi. Rabi then encamped in Zaliq and projected the seizure of Zarang, which though had earlier submitted to Arabs, needed to be subdued again. Although its marzban Aparviz put up a strong resistance, he was forced to surrender.

The Zaranj forces had received heavy casualties during the battle with Arab forces and were driven back to the city. According to sources, when Aparviz appeared before Rabi to discuss the terms, he found the Arab general was sitting on a chair made out of two dead soldiers and his entourage had been instructed to make seats and bolsters in the same fashion. Aparviz was terrified into submission and wished to spare his people of this fate. A peace treaty was concluded with payment of heavy dues. The treaty mandated one million dirhams as annual tribute, in addition to 1,000 slave boys bearing 1,000 gold vessels. The city was also garrisoned by Rabi.

Rabi thus succeeded in gaining Zarang with considerable difficulty and remained at the place for several years. Two years later, the people of Zarang rebelled and expelled Rabi's lieutenant and garrison. Abdallah b. Amir sent 'Abd ar-Rahman b. Samura to take back the city, who also added Bust and Zabul to Arab gains. 'Abd ar-Rahman besieged Zaranj and after the marzban surrendered, the tribute was doubled. The tribute imposed on Zarang was 2 million dirhams and 2,000 slaves.

During the period of the first civil war in the Arab caliphate (656–661), rebels in Zarang imprisoned their governor while Arab bandits started raiding remote towns in Sistan to enslave people. They gave in to the new governor Rib'i, who took control of the city and restored law and order. 'Abdallah b. Amir was made the governor of Basra and its eastern dependencies again from 661 to 664. Samura was sent back to Sistan in 661. An expedition to Khorasan was sent under him that included reputed leaders like Umar b. 'Ubaydillah b. Ma'mar, 'Abdullah b. Khazim, Qatariyy b. al-Fuja'a and Al-Muhallab ibn Abi Sufra. Samura reconquered Zarang, while also conquering the region between Zarang and Kisht, Arachosia, Zamindawar, Bust and Zabul.

Ziyad ibn Abihi was appointed governor of Basra in 664 and was also made governor of Kufa and its dependencies in 670, making him the viceroy of the entire eastern half of the Islamic empire. He sent his kinsman Ubaydallah b. Abi Bakra to destroy the Zoroastrian fire temples in Fars and Sistan, confiscate their property and kill their priests. While the fire temple of Kariyan was destroyed, the one at Karkuya survived along with its herbad. Ziyad's son Abbad was appointed governor of Sijistan by Mu'awiya I in 673 and served until 681. During the course of his governorship, the province apparently remained stable and Abbad led an eastward expedition which brought Kandahar to the caliphate. Caliph Yazid I replaced Abbad with his brother Salm, who was already governor of Khurasan.

Khorasan

There is general agreement among Arabic sources that Khorasan's conquest began in the reign of Uthman under Abdallah b. Amir, who had been appointed the governor of Basra (r. 649–655). Sayf's tradition however disagrees with this, dating it to 639 under the reign of Umar with Ahnaf ibn Qais leading the expedition. Al-Tabari meanwhile relates that Ahnaf's conquests occurred in 643. This could be because of confusion of Ahnaf's later activities under Ibn Amir and an attempt to magnify his role in Khorasan's conquest.

The conquest of southern Persia was completed by 23 AH with Khorasan remaining the only region remaining unconquered. Since the Muslims did not want any Persian land to remain under Persian rule, Umar ordered Ahnaf b. Qais to march upon it. After capturing the towns of Tabas and Tun, he attacked the region's easternmost city Herat. The Persians put up stiff resistance but were defeated and surrendered. A garrison was deployed in the city, while a column was detached which subjugated Nishapur and Tus. Umar had dispatched Ahnaf with 12,000 men from Kufa and Basra after Yazdegerd who had fled to Merv. After the Arabs arrived there, Yazdegerd fled to Marw al-Rudh from where he sent ambassadors to the Khakan of the Turks, the ruler of Soghd and the Chinese emperor, asking for their assistance. Yazdegerd later fled to Balkh, where he was defeated by the Arabs and fled across Oxus River.

Umar forbade Ahnaf from crossing the river as the land beyond it was unknown to Arabs and was very far for them. Yazdegerd proceeded to Soghd whose ruler supplied him with a large army. The Khaqan of Turks after assembling the troops from Ferghana, crossed the Oxus along with Yazdegerd and marched to Balkh. Ribi' b. Amir meanwhile retired with Kufan troops to Marw al-Rudh where he joined al-Ahnaf. The Sasanian king and the Khakan leading an army of 50,000 cavalry composed of men from Soghd, Turkestan, Balkh and Tokharistan, arrived at Marw al-Rudh. Ahnaf had an army of 20,000 men. The two sides fought each other from morning till evening for two months at a place called Deir al-Ahnaf.

The fighting at Deir al-Ahnaf went on until Ahnaf, after being informed of a Turkic chief inspecting the outposts, went there during a particular night and successively killed three Turkic chiefs during their inspection. After learning of their deaths, the Khakan became afflicted by it and withdrew to Balkh, then he withdrew across the river to Turkestan. Yazdegerd meanwhile left from Marw al-Rudh to Merv, from where he took his empire's wealth and proceeded to Balkh to join the Khakan. He told his officials that he wanted to hand himself to the protection of the Turks, but they advised him against it and asked him to seek protection from the Arabs which he refused. He left for Turkestan while his officials took away his treasures and gave them to Ahnaf, submitting to the Arabs and being allowed to go back to their respective homes.

Abdullah b. Amir went to Khorasan from Kerman in 650 and set out along with a vanguard of Tamimi Arabs and 1,000 asawira via Quhistan. The people of Tabasayn had broken their peace treaty and had allied with the Hepthalites of Herat. al-Ahnaf reconquered Quhistan and defeated Herat's Hepthalites at Nishapur. The kanarang or marzban of Tus asked the Arabs for assistance against the raiding Hepthalites of Herat and Badghis. He agreed to a peace agreement for 600,000 dinars.

The Hepthalite action prompted the Muslims undertaking military operation to secure their positions in Khorasan. After the fall of Tus, Ibn Amir sent out an army against Herat. The ruler (marzaban or azim) of the place agreed to a peace treaty for Herat, Badghis and Pushang for a tribute of 1 million dirhams. The ruler who was known as azim or the "mighty one" in Futuh al-Buldan, may have been a Hepthalite chief. The Rashidun Caliphs followed the earlier rule of Muhammad of imposing jizya on several bodies jointly and in some cases also imposed the condition that they host Muslims. This rule was followed in most Iranian towns, with the jizya not specified on per capita basis, but being left to the local rulers, though some Muslim commanders stressed the amount on the ability of the ruler to pay. The same wording can be seen in Ibn Amir's treaty.

In 652, Ibn Amir sent al-Ahnaf to invade Tokharistan with 4,000 Arabs and 1,000 Iranian Muslims (evidently the Tamimis and asawira), probably because of assistance of its ruler to Yazdegerd's son Peroz. While Marw al-Rudh's garrison agreed to a peace term for the entire district under 300,000 dirhams, the town itself remained besieged. It was the last major stronghold of Sasanians and fell to al-Ahnaf after a fierce battle. After bloody fighting, its marzaban agreed to a peace treaty for 60,000 or 600,000 dirhams as well as a mutual defence pact. He was also allowed to keep his ancestral lands, for the office of marzaban to be hereditary in his family, and to be exempt from taxes along with his whole family. Baladhuri quotes Abu Ubayda as stating that the Turks were supporting the inhabitants of the town. These Turks were Hepthalites, probably from Guzgan, which may explain the reason behind the Arabs next attacking Guzgan, Faryab and Talqan.

Al-Mada'ini specifically states that Ahnaf while leading the next expedition, did not want to ask for assistance from the non-Muslims of Marw al-Rudh, probably as he did not trust them. The Arabs camped at Qasr al-Ahnaf, a day's march to the north of Marw al-Rudh. The 30,000-strong army comprising troops of Guzgan, Faryab and Talqan, supported by the Chaghanian troops, advanced to meet them. The battle was inconclusive, but the opposing side dispersed with some remaining at Guzgan while the Arabs withdrew to Marw al-Rudh. Ahnaf sent an expedition, led by al-Aqra' b. Habis and apparently consisting exclusively of Tamimis, to Guzgan. The Arabs defeated Guzgan and entered it by force. Ahnaf meanwhile advanced towards Balkh, making peace treaties with Faryab and Taloqan along the way.

The permanent pacification of Khorasan was a protracted affair with the local potentates often rebelling and appealing to outside powers like the Hepthalites, Western Turks or Turgesh, Sogdians and the imperial Chinese who claimed a degree of suzerainty over Central Asia, for help. Within a year after Yazdegerd's death, a local Iranian notable named Qarin started a revolt against the Arabs in Quhistan. He gathered his supporters from Tabasayn, Herat and Badghis, assembling a reported army of 40,000 insurgents against Arabs in Khorasan. The Arabs made a surprise attack however, killing him and many of his people while many others were taken captive. It was expected that the recently subjugated people would revolt. However, in Khorasan, no all-out effort seems to have been undertaken to the expel the Arabs after Qarin's rebellion. Chinese sources state that there was an attempt to restore Peroz by Tokharistan's army, however this episode is not confirmed by Arab sources.

Peroz had settled among the Turks, took a local wife and had received troops from the king of Tokharistan. In 661, he established himself as king of Po-szu (Persia) with Chinese help in a place the Chinese called Ja-ling (Chi-ling), which is assumed to be Zarang. His campaigns are reflected in Muslim sources, which mention revolts in Zarang, Balkh, Badghis, Herat, Bushanj and also in Khorasan during the First Fitna period in reigns of Ali and Mu'awiya I. Though they do not mention Peroz, they do state that Ali's newly appointed governor of Khorasan had heard in Nishapur that governors of the Sasanian king had come back from Kabul and Khorasan had rebelled. However, the region was reconquered under Mu'awiya. Piroz went back to the Tang Empire's capital and was given a grandiose title as well as permission to build a fire temple in 677.

Yazid ibn al-Muhallab succeeded his father as governor of Khorasan in 702 and campaigned in Central Asia, but achieved little success apart from Nezak Tarkhan's submission at Badghis.

Tokharistan
Tokharistan, roughly ancient Bactria, is today divided between Afghanistan, Tajikistan and Uzbekistan. According to the most general usage of the name, Tokharistan is the wide valley around the upper Oxus river surrounded by mountains on three sides before the river moves into open plains. The major city was Balkh, one of the greatest urban centers of northeastern Iran. It was located upon crossroads and conduits of trade in many directions, enabling control of these routes if it was conquered. During the governorship of Abu 'l Abbas 'Abdallah b. Tahir (r. 828–845), a list of districts (kuwar) of the region exists, including as far as Saghaniyan in the north and Kabul in the south. Other places listed are Tirmidh, Juzjan, Bamiyan, Rūb and Samanjan. Some Arab geographers used the name only for the southern part of Oxus valley.

Balkh was also a part of Khorasan along with other areas through varying extensions of time. Per al-Tabari, Yazdegerd fled from Marw-al Rudh to Balkh during Ahnaf's conquest of Khorasan in 643. He fortified himself but was defeated by the Arabs and fled across the Oxus River. Yazdegerd proceeded to Soghd, whose ruler supplied him a large army. The Khaqan of Turks after assembling the troops from Ferghana, crossed the Oxus along with Yazdegerd and marched to Balkh.

In 652, Ibn Amir sent al-Ahnaf to invade Tokharistan with 4,000 Arabs and 1,000 Iranian Muslims (evidently the Tamimis and asawira), probably because of assistance of its ruler to Yazdegerd's son Peroz. He approached Balkh after conquering Marw al-Rudh and fighting an inconclusive battle with a 30,000-strong force from Guzgan, Faryab and Talqan. After arriving at Balkh, he besieged the city, with its inhabitants offering a tribute of 400,000 or 700,000 dirhams. He deputed his cousin to collect the tribute and advanced to Khwarezm but returned to Balkh as winter approached. It was in Balkh in fall of 652 when the local people introduced his cousin Asid to gifting gold and silver to their governor during Mihrijan.

Ziyad b. Abi Sufyan reorganised Basra and Kufa, excluding many from the diwan and inspiring him to settle 50,000 families in Khorasan. Both Baladhuri and Mad'aini agree upon the number, though the latter states each half were from Basra and Kufa. Al-'Ali disagrees, stating the Kufans were 10,000. Ghalib had been unsuccessful in his expedition, and Rabi b. Ziyad al-Harithi, who was appointed governor of Khorasan in 671, led the settlement expedition. He advanced to Balkh and made a peace treaty with the locals who had revolted after al-Ahnaf's earlier treaty.

Qutayba ibn Muslim led the final conquest of Balkh. He was tasked with subduing the revolt in Lower Tokharistan. His army was assembled in the spring of 705 and marched through Marw al-Rudh and Talqan to Balkh. Per one version in Tarikh al-Tabari, the city was surrendered peacefully. Another version, probably to promote a Bahilite claim on the Barmakids, speaks of a revolt among the residents. The latter may be the correct version as Tabari describes the city as ruined four years later. The wife of Barmak, a physician of Balkh, was taken captive during the war and given to 'Abdullah, Qutayba's brother. She was later restored to her lawful husband after spending a period in 'Abdullah's harem. Khalid was thus born in 706 and Abdallah accepted the implications of paternity without disturbing Barmak's conventional responsibilities or affecting Khalid's upbringing.

In 708–709, the Ispahbadh, who was a local ruler, received a letter from the Hepthalite rebel Nezak Tarkhan, who was trying to unite the aristocracy of Tokharistan against Qutayba. The Arabs built a new military encampment called Baruqan two farsangs away from the city. In 725, the governor Asad ibn Abdallah al-Qasri had the city restored after a feud among Arab troops, with Barmak being employed as his agent for the task.

Early Arabs tended to treat Iran as a single cultural unit, however it was a land of many countries with distinct populations and cultures. From historical evidence, it appears that Tokharistan was the only area heavily colonized by Arabs where Buddhism flourished, and the only area incorporated into the Arab empire where Sanskrit studies were pursued up to the conquest. The grandson of Barmak was the vizier of the Arab empire and took personal interest in Sanskrit works and Indian religions. The eighth-century Korean traveller Hui'Chao records Hinayanists in Balkh under Arab rule. He visited the area around 726, mentioning that the true king of Balkh was still alive and in exile. He also describes all the inhabitants of the regions as Buddhists under Arab rule. Other sources indicate however that the Bactrians practiced many different religions.

Among Balkh's Buddhist monasteries, the largest was Nava Vihara, later Persianized to Naw Bahara after the Islamic conquest of Balkh. It is not known how long it continued to serve as a place of worship after the conquest. Accounts of early Arabs offer contradictory narratives. Per al-Baladhuri, its stupa-vihara complex was destroyed under Mu'awiya in 650s. Tabari while reporting about the expedition in 650s, does not mention any tension around the temple, stating that Balkh was conquered by Rabi peacefully. He also states that Nizak went to pray at the site during his revolt against Qutayba in 709, implying it may not have been destroyed. Also, the tenth-century geographical treatise Hudud al-'Alam describes remaining royal buildings and Naw Bahara's decorations including painted image and wonderful works, probably secco or fresco murals and carvings on the temple's walls that survived into the author's time.

Sanskrit, Greek, Latin and Chinese sources from the 2nd century BC to the 7th century AD, identify a people called "Tukharas", in the country later called Tukharistan. Badakhshan was earlier the seat of the Tukharas. There is no precise date for the Arab conquest of Badakhshan nor any record of how Islam was introduced there. Al-Tabari too mentions this region only once. In 736, Asad ibn Abdallah al-Qasri sent an expedition into Upper Tokharistan and Badakhshan against the rebel Al-Harith ibn Surayj who had occupied the fortress of Tabushkhan. Juday' b. 'Ali al-Kirmani, who was sent on the expedition against al-Harith, captured Tabushkhan. Juday also had its captive defenders killed while its women and children were enslaved and sold in Balkh despite being of Arab origin. al-Harith later allied with the Turgesh and continued his rebellion until being pardoned by Caliph Yazid b. Walid in 744.

Taking advantage of the factional fighting among the Arabs, Transoxania started rebelling and Asad b. 'Abdallah in response attacked Khuttal in 737. Armed forces of Soghd, Chach and many Turks, led by the Turkish Khagan Sulu, arrived to assist them. Asad fled leaving behind the baggage of plunder from Khuttal. When he returned with the main body of his troops, the Turks retired to Tokharistan and he returned to Balkh. In December 737, the Turgesh attacked Khulm but were repelled by the Arabs. Bypassing Balkh, they captured Guzgan's capital and sent out raiding parties. Asad mounted a surprise attack on the Turks at Kharistan, who only had 4,000 troops. The Turgesh suffered a devastating defeat and lost almost whole of their army. Sulu and al-Harith fled to the territory of Tokharistan's Yabghu, with Sulu returning to his territory in winter of 737–738.

The Zunbils
Arabsumf1.png. {{legend|#FFF200|Desert areas (Registan Desert and Thar Desert)}} {{legend|#FFC90E|Zunbils}} {{legend|#FFC891|Turk Shahis}} {{legend|#A349A4|Kingdom of Kashmir}} {{legend|#CD9F87|Kingdom of Sindh (c. 632– 711 CE) then, Caliphal province of Sind (712-854 CE)}}

]] The Zunbils in the pre-Saffarid period ruled in Zabulistan and Zamindawar, stretching between Ghazni and Bost, and had acted as a barrier against Muslim expansion for a long time. Zamindawar is known to have a shrine dedicated to the god Zun. It has been linked with the Hindu god Aditya at Multan, pre-Buddhist religious and kingship practices of Tibet, as well as Shaivism. The followers of the Zunbils were called Turks by the Arabic sources, however they applied the name to all their enemies in eastern fringes of Iran. They are described as having Turkish troops in their service by sources like Tabari and Tarikh-e-Sistan.

The first time the title of Zunbil appears in Arabic sources, it does so along with that of the Kabul Shah and according to Tabari was the title of the brother of Kabul's king (either Barha Tegin or Tegin Shah). The Zunbil apparently broke away from the overlordship of Kabul around 680 AD and established his own kingdom in Zabulistan and al-Rukhkhaj.

The kingdom of Zabulistan (ar-Rukhkhaj) with its capital at Ghazni, where the king Zunbil or Rutbil resided, is mentioned by Chinese sources under the suzerainty of Jabghu of Turkestan. The significance for Arabs of the realm of Zun and its rulers was them preventing their early campaigns from invading the Indus Valley through eastern and southern Afghanistan. It was only under the early Saffarids that mass-Islamization took place unlike the plunder-raids or tribute levies of Arab rule. The expeditions under Caliph al-Ma'mun against Kabul and Zabul were the last ones and the long conflict ended with the dissolution of the Arab empire following soon thereafter.

Sakawand in Zabulistan was a major centre of Hindu pilgrimage.

7th century
After appearing at Zarang, Abd al-Rahman ibn Samura and his force of 6,000 Arabs penetrated to the shrine of Zun in 653–654. He broke off a hand from the idol of Zun and plucked out the rubies used as its eyes to demonstrate to the marzban of Sistan that the idol could neither hurt nor benefit anyone. He also took Zabul by treaty by 656. In the shrine of Zoon in Zamindawar, it is reported that Samura "broke off a hand of the idol and plucked out the rubies which were its eyes in order to persuade the marzbān of Sīstān of the god's worthlessness." Samura explained to the marzbān: "my intention was to show you that this idol can do neither any harm nor good." Bost and Zabul submitted to the Arab invader by treaty in 656 CE. The Muslims soon lost these territories during the First Civil War (656–661).

In 665 CE, after being reappointed to Sistan under Mu'awiya, Samura defeated Zabulistan whose people had broken the earlier agreement. Samura was replaced as governor by Rabi b. Ziyad and died in 50 AH (670 AD), while the king of Zabul rebelled along with the Kabul Shah and the two together reconquered Zabulistan and Rukhkhaj according to al-Baladhuri.

Ar-Rabi, the Arab governor, however attacked the Zunbil at Bust and made him flee. He then pursued him to Rukhkhaj, where he attacked him and then subdued the city of ad-Dawar. Ziyad b. Abi Sufyan was appointed governor of Basra in 665, with Khorasan and Sistan coming under his mandate as well. He had first appointed Rabi to Sistan but replaced him later with 'Ubaydallah b. Abi Bakra. During this period, Zunbil's fierce resistance continued until he finally agreed to pay one million dirhams per Baladhuri and Tarikh-e-Sistan. The Zunbil also negotiated for a peace treaty for both Zabul and Kabul.

Al-Baladhuri records that under Mu'awiya, Sistan's governor 'Abbad b. Ziyad b. Abihi raided and captured the city of Qandahar after bitter fighting. He also mentions the characteristic high caps of the people of the city. Though his text is somewhat ambiguous, it seems that 'Abbad had renamed the town as 'Abbadiya after himself. The Muslim rule was probably toppled and the name is never heard after his governorship ended in 680–1, by 698 there was no Muslim-controlled region east of Bost. The city was ruled by Arab Muslims and Zunbils, and then later Saffarids and Ghaznavids. It is infrequently mentioned in the early Islamic sources.

In 681, Salm b. Ziyad was appointed the governor of Khorasan and Sistan by Yazid I. He appointed his brother Yazid b. Ziyad, apparently to lead a military expedition against the Zunbil of Zabulistan. The expedition however was disastrous, with Yazid being killed, his brother Abu-'Ubayda captured, while Arabs received heavy casualties. Salm sent an expedition by Talha b. 'Abdillah al-Khuzai to rescue his brother and pacify the region. The Arab captives were ransomed for half million dirhams and the region was pacified more through diplomacy than force.

After Talha's death in 683–684, a virtual anarchy was unleashed amongst Sistan's Arabs. His army refused allegiance to Yazid or Mu'awiya II and his son 'Abadallah had to abandon Zarang, which was left without any in charge. Many Arabs took over various quarters of Zarang and areas of Sistan. This prompted the Zunbil and his allies, who had already inflicted a humiliating defeat on the Arabs earlier, to intervene in the Arab affairs at Sistan and Bust. Baladhuri says of this period:

During the Second Fitna period, the Zunbil attacked Sistan in 685 but was defeated and killed by the Arabs.

Abdalmalik appointed Umayya ibn Abdallah ibn Khalid ibn Asid as governor of Khorasan in 74 AH (693-4 AD), with Sistan included under his governorship. Umayya sent his son Abdullah as head of the expedition in Sistan. Though initially successful, the new Zunbil was able to defeat them. Per some accounts, Abdullah himself was killed. Umayya was dismissed and Sistan was added to the governorship of al-Hajjaj ibn Yusuf.

Under Al-Hajjaj
Al-Hajjaj, who had become governor of Iraq and the East in 78 AH (697–98 AD), had appointed Ubaidallah, who was a mawla of mixed Abyssinian and Iraqi-Persian origins, as his deputy in Sistan. The Zunbils, who had been left unchecked, had completely stopped paying the tribute. This provided a pretext to terminate the peace treaty between the two sides. Ubaidallah was appointed for an expedition against them in 698 and was ordered by Al-Hajjaj to "attack until he laid waste to Zunbil's territories, destroyed his strongholds, killed all his fighting men and enslaved his progeny". The ensuing campaign was called the "Army of Destruction" (Jaish al-Fana'). However, it ended disastrously for the Arabs.

Al-Baladhuri's account on the authority of Al-Mada'ini in Futuh al-Buldan and Ansab al-Ashraf, is the fullest documentation of the campaign. Tabari's account runs parallel but is based on Abu Mikhnaf and does not include the poem of A'sha Hamdan included in Ansab al-Ashraf. Ibn Qutaybah's Kitab al-Ma'arif only makes a bare mention. Ta'rikh al-khulafa' has a more detailed account and epitomises accounts of Tabari and Baladhuri. Tarikh-e-Sistan confuses the campaign with another one against the Khwarij of Zarang. The army consisted of Iraqis from Basra and Kufa, though Baladhuri mentions presence of some Syrians. Ubaidallah himself led the Basrans while the Tabi Shuraih b. Hani' al-Harithi ad-Dabbi led the Kufans.

They marched to Zamindawar or al-Rukhkhaj (the classical Arachosia) but found it barren and foodless. Their advance probably happened in summer of 698, as A'sha Hamdan's poem refers to the scorching heat they had to endure. In Zabulistan's regions of Ghazni and Gardiz, they plundered a significant amount of cattle and other animals, in addition to destroying various strongholds. The Zunbils, who were devastating the countryside whilst retreating, were luring the Arabs into a trap to an inhospitable and foodless terrain. Futuh al-Buldan states that the Muslims almost penetrated Kabul. Tabari meanwhile says that they came within 18 farsakhs of the summer capital of Zunbils in the Qandahar region.

The plan of the Zunbils worked and they trapped the Arabs into a valley. Ubaidallah realizing the gravity of the situation, offered 500,000 or 700,000 dirhams as well as his three sons along with some Arab leaders as hostages while promising not to raid again during his tenure as Sistan's governor. Shuraih, who had earlier advised retreat, felt a withdrawal would be dishonorable. He was joined by a group of people into the battle, and all but a handful of them were killed. The remnant of the Arab army withdrew back to Bust and Sistan, suffering from starvation and thirst. Many died in the "Desert of Bust", presumably the Registan Desert, with only 5,000 making it back to Bust. Many of those who survived died by gorging themselves on the food sent to them according to Tabari. Ubaidallah had arranged food for them after seeing their suffering and himself died, either from grief or an ear affliction.

Al-Hajjaj prepared another expedition in 699, reportedly of 40,000 troops from Kufa and Basra under Abdurrahman b. Muhammad b. al-Ash'ath. Though disguised as a military expedition, it was actually a forced migration of the elements from the two Iraqi cities troublesome to Hajjaj. It was equipped to the best standards and was called the "Army of Peacocks" because of the men included in its ranks. It included the proudest and most distinguished leaders of Iraq led by Ibn al-Ash'ath, grandson of Al-Ash'ath ibn Qays. It also included distinguished elders who served in the first armies of conquest as well as those who fought at Battle of Siffin. This Arab army arrived in Sistan in the spring of 699.

The Arabs advanced east into Zabulistan and won several victories. However the troops did not want to fight in this inhospitable region and started becoming restive. Al-Hajjaj instructed them to continue the advance into Zabulistan's heart no matter what it took, making it clear to them he wanted them to return to their homes. Ibn al-Ash'ath also made an agreement with the Zunbils, that no tribute would be demanded if he won and in case he lost, he would be sheltered to protect him from Al-Hajjaj. The troops mutinied against Hajjaj's enforced emigration and returned to Iraq but were crushed by the Syrian troops. They fled back to the east while Ibn al-Ash'ath fled to Sistan where he died in 704 AD.

When Ibn al-Ash'ath returned to Sistan in 702-703 AD, he wasn't allowed into Zarang and fled to Bust where he was abducted by Iyad b. Himyan al-Bakri as-Sadusi, whom he had appointed as the deputy over Bust, so Iyad could resecure favor of al-Hajjaj. The Zunbil however attacked the town and threatened to slaughter or enslave everyone there unless Ibn al-Ash'ath was handed over to him. Iyad set him free and he went to the Zunbil's territory along with his army. The Zunbil was however persuaded by Al-Hajjaj's representative to surrender him. His fate is however unclear. Per some accounts, he committed suicide, while according to others he was killed by the Zunbil, who sent his head to the Umayyads in Sistan. Following this, a truce was declared between Al-Hajjaj and the Zunbil, in return for the latter paying tribute in kind and in return, Al-Hajjaj promised not to attack him.

From 8th century
Qutayba b. Muslim, the conqueror of Transoxiana, called Sijistan an "ill-omened front", and forced the Zunbils to pay tribute. Khalid al-Qasri in Iraq appointed Yazid b. al Ghurayf al-Hamdani as Sistan's governor, a Syrian from Jund al-Urdunn, in 725. Yazid resumed the campaign by sending an army under the command of Balal b. Abi Kabsha. They however did not obtain anything from the Zunbils.

The new governor of Sistan, al-Asfah b. 'Abd Allah al-Kalbi, a Syrian, embarked on an ambitious policy of campaigning against the Zunbils. The first one was carried out in 726. During the second one in late 727–728, he was warned by the Sijistanis who were with him to not campaign in winter, especially in the mountain defiles. Per Ya'qubi, his army was completely annihilated by the Zunbils. Per Tarikh al-Sistani, al-Asfah managed to get back to Sistan where he died. The next two governors did not undertake any campaigns. The Zunbil was unable to take advantage of the annihilation of al-Asfah's army, but the defeat was a heavy one. It would become one in a series of blows for the caliphate.

The Sistan front remained quiet in the latter part of Abd al-Malik's reign except perhaps the Kharjite activity, with long tenures and blank records of 'Abd Allah b. Abi Baruda and Ibrahim b. 'Asim al-'Uqayli suggesting that the instability in the region had been controlled to an extent. It appears this was only possible because no more campaigns were undertaken against the Zunbils.

Al-Mansur sent Ma'n b. Zaida ash-Shabani to Sistan in response to the disturbances there. Ma'n along with his nephew Yazid b. Ziyad undertook an expedition against the Zunbil for making him obedient and restoring the tribute not paid since the time of al-Hajjaj. It is especially well-documented by al-Baladhuri. He ordered the Zunbil to pay the tribute and was offered camels, Turkish tents and slaves, but this did not placate him. Per al-Baldahuri, under the reign of al-Mansur, Hisham b. 'Amr al-Taghlibi after conquering Kandahar, destroyed its idol-temple and built a mosque in its place.

Ma'n and Yazid advanced into Zamindawar but the Zunbil had fled to Zabulistan. They nonetheless pursued and defeated him, taking 30,000 as captives, including Faraj al-Rukhkhaji, who would later become a secretary of the department of private estates of the Caliph under al-Ma'mun. Zunbil's deputy Mawand (who is recorded as his son-in-law Mawld in Tarikh-e-Sistan) offered submission, which was requested, and was sent with 5,000 of their soldiers to Baghdad, where he was treated kindly and given pensions along with his chieftains per Baladhuri.

The tribute was paid by the Zunbils to amils of caliphs al-Mahdi and ar-Rashid, though rather irregularly. When the Caliph Al-Ma'mun (r. 813–833 AD) visited Khorasan, he was paid double the tribute by Rutbil, but was evidently left unmolested and the Arabs later subdued Kabul.

Kabulistan
The area of Kabul was initially ruled by the Nezak Huns. Sometime after the defeat of their last king Ghar-ilchi at the hands of Samura, the Turkic Barha Tegin rebelled and assaulted Kabul. Ghar-ilchi was killed and Barha Tegin proceeded to proclaim himself as the king of Kabul, before taking Zabulistan in the south. The "Turk Shahi" dynasty established by him however split into two around 680 AD. The dynasty was Buddhist and were followed by a Hindu dynasty shortly before the Saffarid conquest in 870 AD.

Al-Ma'mun's expeditions were the last Arab conflict against Kabul and Zabul and the long-drawn conflict ended with the dissolution of the empire. Muslim missionaries converted many people to Islam; however, the entire population did not convert, with repetitive revolts from the mountain tribes in the Afghan area taking place. The Hindu Shahi dynasty was defeated by Mahmud of Ghazni (r. 998–1030), who expelled them from Gandhara and also encouraged mass-conversions in Afghanistan and India.

During the caliphate of Uthman, new popular uprisings had broken out in Persia and continued for five years from 644 to 649. The revolts were suppressed and Abdullah b. Amir, who was appointed governor of Basra, had captured many cities including Balkh, Herat and Kabul.

After Mu'awiya became the Caliph, he prepared an expedition under 'Abd ar-Rahman b. Samura to Khorasan. Per Baladhuri, after recapturing Zarang as well as conquering other cities, the Arabs besieged Kabul for a few months and finally entered it. Samura concluded a treaty and proceeded to attack Bost, al-Rukhkhaj and Zabulistan. The people of Kabul however rebelled and Samura was forced to recapture the city. The account of Tarjuma-i Futuhat however differs and states that Samura besieged the city for a year. After capturing it, he had all the soldiers massacred and their wives and children taken as captives. He also ordered the captured king Ghar-ilchi to be beheaded, but spared him when he converted. Around the same time according to al-Baladhuri, Al-Muhallab ibn Abi Sufra launched an attack on the Indian frontier, reaching up to Bannu and "al-Ahwaz" (Waihind). The historian Firishta states that while capturing Kabul in 664 AD, Samura had made converts of some 12,000 people.

The new king of Kabul Barha Tegin and the Zunbil campaigned against the Arabs after Samura's departure, recapturing Kabul, Zabulistan and al-Rukhkhaj. Rabi b. Ziyad attacked the Zunbil after becoming governor in 671 AD. His successor Ubayd Allah b. Abi Bakra continued the campaign in 673 AD, with the Zunbil negotiating for both Zabul and Kabul soon afterwards. About the time of death of Yazid I however, "the people of Kabul treacherously broke the compact". The Arab army sent to reimpose it was routed.

In about 680–683, the kingdom split into two with the Zunbil fleeing from his brother, the king of Kabul, and approaching Salm b. Ziyad at Amul in Khorasan. In return for him agreeing to acknowledge Salm as his overlord, the Zunbil was allowed to settle down in Amul. Soon he drove his brother out and established himself in Amul. The location of Amul mentioned by Tabari is not certain, Josef Markwart identified it with Zabul. Tabari however claims the Kabul Shah fled instead from the Zunbil and established himself as an independent king during the reign of Mu'awiya.

Abdur Rehman, who studied the descriptions of Tabari however stated that these events should be seen as having happened in Yazid's time since Salm was governor under his reign. In 152 AH (769 AD), Humayd ibn Qahtaba, the governor of Khorasan, raided Kabul. According to Ibn al-Athir, al-'Abbas b. Ja'far led an expedition against Kabul sent by his father Ja'far b. Muhamamad in 787–78, which Bosworth claims is the one attributed to Ibrahim b. Jibril by Al-Ya'qubi.

The only record of an event in early Abbasid period obviously related to the area south of the Hindu Kush, is the expedition against Kabul in 792-793 ordered by Al-Fadl ibn Yahya and led by Ibrahim b. Jibril. It is mentioned by al-Tabari's chronicle, the tenth century Kitāb al-Wuzarā'wa al-Kuttāb of al-Jahshiyari and by al-Ya'qubi. Per al-Jahshiyari, he conquered Kabul and acquired a lot of wealth. Al-Ya'qubi states that rulers and landlords of Tukharistan, including Bamiyan's king, joined this army, implying it crossed the Hindu Kush from the north. It also mentions the subjugation of "Ghurwand" (present-day Ghorband). He also mentions the "Pass of Ghurwand", which judging by the itinerary of the expedition from Tukharistan to Bamiyan to Ghorband valley, is identical to Shibar Pass. They then marched to Shah Bahar where an idol venerated by the locals was destroyed. The inhabitants of various towns then concluded peace treaties with Fadl, one of which was identified by Josef Markwart as Kapisa.

Al-Ma'mun (r. 813–833 AD) while visiting Khorasan, launched an attack on Kabul, whose ruler submitted to taxation. The king of Kabul was captured and he then converted to Islam. Per sources, when the Shah submitted to al-Ma'mun, he sent his crown and bejeweled throne, later seen by the Meccan historian al-Azraqi, to the Caliph who praised Fadl for "curbing polytheists, breaking idols, killing the refractory" and refers to his successes against Kabul's king and ispahabad. Other near-contemporary sources however refer to the artifacts as a golden jewel-encrusted idol sitting on a silver throne by the Hindu Shahi ruler or by an unnamed ruler of "Tibet" as a sign of his conversion to Islam.

Qutayba's campaigns
Qutayba b. Muslim was appointed the governor of Khorasan in 705 by al-Hajjaj b. Yusuf, the governor of Iraq and the East. He began his rule with the reconquest of western Tokharistan in the same year. Qutayba, who was tasked with subduing the revolt in Lower Tokharistan, led the final conquest of Balkh. His army was assembled in spring of 705 and marched to Balkh. Per one version of al-Tabari, the city was surrendered peacefully. Another version, speaks of a revolt among the residents. In 706, he received the submission of Nizak, the leader of Badghis. In 707, he marched on Bukhara oasis along with Nizak in his army but the campaign did not achieve any major objective.

According to Baldhuri, when Qutayba became the governor of Khorasan and Sistan, he appointed his brother 'Amr to Sistan. 'Amr asked the Zunbil to pay tribute in cash but he refused, prompting Qutayba to march against him. The campaign was also partially encouraged by his desire to eliminate the support of the southern Hepthalites, the Zabulites, for their northern brethren to revolt. Zunbil, who was surprised by this unexpected move and scared of Qutayba's reputation, quickly capitulated. Qutayba, realizing the real strength of the Zunbils, accepted it and returned to Merv, leaving only an Arab representative in Sistan.

Per Al-Mada'ini, Qutayba returned to Merv after conquering Bukhara in 709. The rebellion of the Hepthalite principalities from the region of Guzgan, including Taloqan and Faryab, led Qutayba to dispatch 12,000 men from Merv to Balkh in winter of 709. The rebellion was led and organized by Nezak Tarkhan and was supported by Balkh and Marw al-Rudh's dihqan Bādām. Nizak had realised that independence would not be possible if Arab rule was strengthened in Khorasan, and perhaps was also encouraged by Qutayba's attempts to achieve his objectives through diplomacy. The success of Zunbils may also have encouraged him.

Nizak wrote to the Zunblis asking for help. In addition, he also forced the weak Jābghū of Tokharistan to join his cause to persuade all princes of the Principalities of Tukharistan to do the same. His plan to stage the revolt in spring of 710 was however spoilt by Qutayba. Bādām fled when Qutayba advanced on Marw al-Rudh but his two sons were caught and crucified by him. Qutayba next marched to Taloqan, which was the only place in his campaign where the inhabitants were not given a complete amnesty, concerning which H.A.R. Gibb states the "traditions are hopelessly confused". Per one account, he executed and crucified a band of bandits there, though it is possible it was selected for this severity as it was the only place where there was an open revolt.

Faryab and Guzgan both submitted and their inhabitants were not harmed. From there, Qutayba went on to receive the submission of people of Balkh. Almost all of Nizak's princely allies had reconciled themselves with Qutayba and there were Arab governors in all towns of Tokharistan, spoiling his plans. He fled south to the Hindu Kush, hoping to reach Kabul and entrenched himself in an inaccessible mountain pass guarded by a fortress. The Arabs succeeded in gaining the fort with help of Ru'b Khan, ruler of Ru'b and Siminjan. Nizak fled along the modern road that leads from the Oxus valley to Salang Pass and holed up in an unidentified mountain refuge in a site of Baghlan Province. Qutayba caught up with him and besieged him for two months.

Sulaym al-Nasih (the counsellor), a mawla of Khorasan, helped in obtaining Nizak's surrender to Qutayba who promised a pardon. Nonetheless, he was executed along with 700 of his followers after orders from al-Hajjaj. The Jabghu of Tokharistan was sent as a valuable hostage to Damascus. Qutayba then went in pursuit of Juzjan's king, who requested amnesty and called for exchange of hostages as a precautionary measure. This was agreed upon and Habib b. 'Abd Allah, a Bahilite, was sent as prisoner by Qutayba while the king sent some of his family members in return. The peace treaty was agreed but the king died in Taloqan on his return journey. His subjects accused the Muslims of poisoning him and killed Habib, with Qutayba retaliating by executing Juzjan's hostages.

Ghur
Tabari records that in 667 AD, Ziyad b. Abihi had sent Hakam b. 'Amr al-Ghafri to Khorasan as Amir. Hakam raided Ghur and Farawanda, bringing them to submission through force of arms and conquered them. He obtained captives and a large amount of plunder from them. A larger expedition was undertaken under Asad ibn Abdallah al-Qasri, the governor of Khorasan, who raided Gharchistan in 725, receiving its submission as well as the conversion of its king to Islam. He next attacked Ghur whose residents hid their valuables in an inaccessible cave, but he was able to plunder the wealth by lowering his men in crates.

Asad's success prompted him to undertake a second expedition in 108-109 AH against Ghur. The poet Thabit Qutna's eulogical poem of Asad recorded by Tabari called it a campaign against the Turks saying, "Groups of the Turks who live between Kabul and Ghur came to you, since there was no place in which they might find refuge from you." Bosworth states that this campaign may have actually taken place in Guzgan or Bamiyan rather than the purely-Iranian Ghur. He also states that no doubt further sporadic raids continued throughout the Umayyad rule, though not noted by historians. It is known that Nasr ibn Sayyar's commander Sulaiman b. Sul had raided Gharchistan and Ghur some time before 739 AD.

The early history of Ghor is unclear. Minhaj-i-Siraj in Tabaqat-i-Nasiri states that Shansab, who established the Ghurid dynasty, was converted by the Arab Caliph Ali which Mohammad Habib and K. A. Nizami dismissed as unlikely. He further adds that the Ghurid Amir Faulad assisted Abu Muslim in overthrowing the Umayyads during the Abbasid Revolution. He also recounts a legend about a dispute between two prominent families of the area. They sought the intercession of the Abbasids and the ancestor of the Shansabi family, Amir Banji, was subsequently confirmed as the ruler by Harun al-Rashid.

No permanent control was ever established on Ghur. According to Bosworth, its value was only for its slaves which could best be obtained in occasional temporary raids. Arab and Persian geographers never considered it important. In all sources it is cited as supplying slaves to slave markets in Khorasan, indicating it had a mostly "infidel" population. Istakhari called it a land of infidels (dar al-kufr) annexed to Islamic domain because of its Muslim minority. However Hudud al-'Alam stated it had a mostly-Muslim population.

Ghazni
The pre-Ghaznavid royal dynasty of Ghazni were the Lawiks. Afghan historian 'Abd al-Hayy Habibi Qandahari, who in 1957 examined a manuscript containing tales about miracles (karamat) of Shaikh Sakhi Surur of Multan, who lived in the 12th century, concluded it dated to 1500. He recorded one of its anecdotes which records the history of Ghazni by the Indian traditionalist and lexicographer Radi ad-Din Hasan b. Muhammad al-Saghani (died 1252) from Abu Hamid az-Zawuli. According to it, a great mosque at Ghazni was earlier a great idol-temple built in honor of the Rutbils and Kabul-Shahs by Wujwir Lawik. His son Khanan converted to Islam and was sent a poem by the Kabul-Shah saying, "Alas! The idol of Lawik has been interred beneath the earth of Ghazni, and the Lawiyan family have given away [the embodiment of] their kingly power. I am going to send my own army; do not yourself follow the same way of the Arabs [ie., Islam]."

Habibi continues stating that Khanan later reconverted to the faith of the Hindu-Shahis. His grandson Aflah however upon assuming power demolished the idol-temple and built a mosque in its place. When the saint Surur arrived at the mosque, he is said to have found the idol of Lawik and destroyed it. The Siyasatnama of Nizam al-Mulk, the Tabaqat-i Nasiri of Juzjani and the Majma' al-ansāb fī't-tawārīkh of Muhammad Shabankara'i (14th century) mention Lawik. Juzjani gives the Lawik who was defeated by Alp-tegin the Islamic kunya of Abu Bakr, though Shabankara'i claims he was a pagan. A variant of his name appears as Anuk in Tabaqat-i Nasiri.

The Buddhist monastery of Tepe Sardar existed near Ghazni during the time Arabs were threatening the Ghazni region, and was destroyed by a fire possibly due to the first Muslim invasion of the region in 671–672 CE. It may have been the "Šāh Bahār" (temple of the king) mentioned as having been destroyed by Muslims in 795 CE in the Kitab al-Buldan.

Bamyan
Ya'qubi states that the lord of Bamyan called the Shēr, was converted to Islam under Caliph Al-Mansur (d.775) by Muzahim b. Bistam, who married his son Abu Harb Muhammad to his daughter. However, in his history he changes it to the rule of Al-Mahdi (r. 775–785). Ya'qubi also states that Al-Fadl ibn Yahya made Hasn, Abu Harb Muhammad's son, as the new Shēr after his successful campaign in Ghorband. Ya'qubi states that the ruler of Bamiyan had accompanied an expedition dispatched by Al-Fadl ibn Yahya in 792–793 against the Kabul Shahi.

Later Shers remained Muslim and were influential at the Abbasid court. However, Muslim sources describe the Saffarid ruler Ya'qub ibn al-Layth al-Saffar looting Bamiyan's pagan idols. A much later historian Shabankara'i claims that Alp-Tegin obtained conversion of the Sher to Islam in 962. It seems there were lapses to Buddhism among some of the rulers as the Muslim influence grew weak. However, there is no evidence about the role of Buddhism during these periods or whether Buddhist monasteries remained the center of religious life and teaching.

Tahirids
Khurasan was the base for early recruitment of Abbasid armies, especially the Abbasid takeover received support from Arab settlers aiming to undermine the important sections of non-Muslim aristocracy. The Abbasids succeeded in integrating Khorasan and the East into the central Islamic lands. The state was gradually Persianized through political influence and financial support of the dihqans. Al-Ma'mun emerged as the victor in the Fourth Fitna with the help of Khorasani forces and appointed Tahir ibn Husayn as the governor. Later, he appointed Talha as the governor in 822 and Abdallah in 828. But after the Abbasid decline, Khorasan ended up turning into a virtually independent state under a Persian mawla who rose to favour under Al-Ma'mun.

According to Ibn Khordadbeh, the Shah of Kabul had to send 2,000 Oghuz slaves worth 600,000 dirhams as annual tribute to the governor of Khorasan Abdallah ibn Tahir (r. 828-845). In addition to the Oghuz slaves, he also had to pay an annual tribute of 1.5 million dirhams. Mid-9th century, one of their tributaries Abu Da'udid or the Banijurid Amir Da'ud b. Abu Da'ud Abbas, undertook an obscure campaign into eastern Afghanistan and Zabulistan that was profitable. It is recorded that in 864 Muhammad ibn Tahir sent two elephants captured at Kabul, idols and aromatic substances to the caliph.

Ya'qub b. al-Layth
The Tahirid rule was overthrown by Ya'qub ibn al-Layth al-Saffar of Sistan, the first independent Iranian ruler in the post-Islamic era. He also fought against the Abbasid Caliphate. He joined the 'ayyar band of Salih b. al-Nadr/Nasr, who was recognised as Bust's amir in 852. al-Nasr aimed at taking over whole of Sistan and drove out the Tahirid governor in 854, with Sistan ceasing to be under the direct control of the Caliphate. al-Nasr himself was overthrown by Dirham b. Nasr who was overthrown by Ya'qub in 861. Ya'qub and his brother Amr advanced as far as Baghdad and to Kabul itself in eastern Afghanistan with their dynamism, advancing along the historic route taken by the modern Lashkargah-Qandahar-Ghazni-Kabul road. Their eastern campaigns are documented by Arabic sources of Al-Masudi's Murūj adh-dhahab, Ibn al-Athir's al-Kāmil fi't-tā'rīkh and Tarikh-e-Sistan. The Persian historian Gardizi's Zain al-akhbār also mentions the Saffarid campaigns.

Salih fled to ar-Rukhkhaj or Arachosia, where he received the help of the Zunbil. Both Salih and the Zunbil were killed by Ya'qub in 865. Abu Sa'id Gardezi mentions that Ya'qub advanced from Sistan to Bust and occupied the city. From here he advanced to Panjway and Tiginabad (two of the chief towns of Arachosia), defeating and killing the Zunbil, though the date is not given. This account matches with that of Tarikh-e-Sistan. Satish Chandra states that, "We are told that it was only in 870 AD that Zabulistan was finally conquered by one Yakub who was the virtual ruler of the neighbouring Iranian province of Siestan. The king was killed and his subjects were made Muslims."

Muhammad Aufi's Jawami ul-Hikayat meanwhile states that during his invasion of Zabul, Yaqub employed a ruse to surrender after being allowed to pay homage to the ruler along with his troops, lest they disperse and become dangerous to both sides. Yaqub's troops "carried their lances concealed behind their horses and were wearing coats of mail under their garments. The Almighty made the army of Rusal (probably Rutbil), blind, so that they did not see the lances. When Yaqub drew near Rusal, he bowed his head as if to do homage, but raised a lance and thrust it in the back of Rusal so that he died on the spot. His people also fell like lightning upon the enemy, cutting them down with their swords and staining the earth with the blood of the enemies of the religion. The infidels when they saw the head of Rusal upon the point of a spear took to flight and great bloodshed ensued. This victory, which he achieved, was the result of treachery and deception, such as no one had ever committed."

Ashirbadi Lal Srivastava states that after this victory by Yaqub over Zabul, the position of Lallya alias Kallar, the Brahmin minister who had overthrown the last Kshatriya king of Kabul Lagaturman, seems to have become untenable. He shifted his capital to Udhaband in 870 AD. Lallya, credited as an able and strong ruler by Kalhana in Rajatarangini, was driven out by Ya'qub from Kabul within a year of his usurpation according to Srivastava.

Gardezi states that after defeating the Zunbil, Yaqub then advanced into Zabulistan and then Ghazni, whose citadel he destroyed and forced Abu Mansur Aflah b. Muhammad b. Khaqan, the local ruler of nearby Gardez, to tributary status. Tarikh-e-Sistan however in contrast states that he returned to Zarang after killing Salih. This campaign may be related to Gardizi's account of a later expedition in 870 where he advanced as far as Bamiyan and Kabul. Salih b. al-Hujr, described as a cousin of the Zunbil, was appointed as the Saffarid governor of ar-Rukhkhaj, but rebelled two years after Zunbil's death and committed suicide to avoid capture.

Ya'qub had captured several relatives of the Zunbil's family after defeating Salih b. al-Nasr. Zunbil's son escaped from captivity in 869 and quickly raised an army in al-Rukhkhaj, later seeking refuge with the Kabul-Shah. Per Gardizi, Ya'qub undertook another expedition in 870 which advanced as far as Kabul and Bamiyan. According to Tarikh-e-Sistan, Bamiyan was captured in 871 and its idol-temple was plundered. Ya'qub defeated Kabul in 870 and again had to march there in 872 when the Zunbil's son took possession of Zabulistan. Ya'qub captured him from the fortress of Nay-Laman where he had fled. In 871, Ya'qub sent 50 gold and silver idols he gained by campaigning from Kabul to Caliph Al-Mu'tamid, who sent them to Mecca.

According to Tabaqat-i-Nasiri, Ghor, which was ruled by Amir Suri in the 9th century, entered into a war against Ya'qub, but escaped conquest due to its difficult and mountainous terrain.

Amr b. al-Layth
After Ya'qub's death in 879, Al-Mu'tamid recognised his brother and successor 'Amr b. al-Layth (r. 879–902), as governor of Khorasan, Isfahan, Fars, Sistan and Sindh. The caliph however announced divesting him of all his governorships in 885 and reappointed Muhammad b. Tahir as the governor of Khorasan. He was reappointed governor of Khorasan in 892 by Al-Mu'tadid.

Amr led an expedition as far as Sakawand in the Logar Valley, between Ghazni and Kabul, described as a Hindu pilgrimage-centre. In 896, he sent idols captured from Zamindawar and the Indian frontier, including a female copper idol with four arms and two girdles of silver set with jewels and pulled on a trolley by camels, to Baghdad. Al-Baihaki mentions Sakawand as a pass from Kabul to India. It was situated at or near Jalalabad. The idol taken from somewhere in eastern Afghanistan by Amr was displayed for three days in Basra and then for three days in Baghdad. Jamal J. Elias states that it may have been of Lakshmi or Sukhavati at Sakawand. Al-Masudi emphasises the attention it received as a spectacle, with crowds gathering to gawk at it.

Aufi states that Amr had sent Fardaghan as the prefect over Ghazni and he launched the raid on Sakawand, which was a part of the territory of Kabul Shahi and had a temple frequented by Hindus. The Shah of Kabul at this time was Kamaluka, called "Kamalu" in Persian literature. Fardaghan entered it and succeeded in surprising Sakawand. Sakawand was plundered, and its temple destroyed.

Kamalu counter-attacked Fardaghan, who realising his forces were no match for his, resorted to spreading a false rumour that he knew his intentions and had organised a formidable army against him with 'Amr on the way to join him. The rumour had the desired effect and the opposing army slowed its advance, knowing that they could be ambushed and slaughtered if they advanced impetuously into the narrow defiles. Meanwhile, Fardaghan received reinforcements from Khorasan according to Aufi. According to Aufi, he cleverly averted the danger.

Tarikh-e-Sistan does not mention any attack by Fardaghan on Sakawand however, instead beginning with the attack by Kamalu. Per it, when Amr was in Gurgan, he heard that Nasad Hindi and Alaman Hindi had allied and invaded Ghazni. The Saffarid governor 'Fard 'Ali was defeated and fled.

Samanids

The Samanids came to rule over areas including Khorasan, Sistan, Tokharistan and Kabulistan after Ismail (r. 892–907) in 900 AD had defeated the Saffarids, who had taken over Zabulistan and the Kabul region. The Turks were highly noted for their martial prowess by the Muslim sources and were in high demand as slave-soldiers (ghulam, mamluk) by the Caliphate in Baghdad and the provincial emirs. The slaves were acquired either in military campaigns or through trade. The Samanids were heavily involved in this trade of Turkish slaves from lands to the north and east of their state. As the enslavement was limited to non-Muslims and with the Turks increasingly adopting Islam beyond Samanid borders, they also entered Transoxiana as free men due to various causes.

The Ghaznavids arose indirectly from the atmosphere of disintegration, palace revolutions and succession putsches of the Samanid Empire. Abu-Mansur Sabuktigin was one of the Samanid slave guards who rose from the ranks to come under the patronage of the Chief Hajib Alp-Tegin. After the death of the Samanid Amir 'Abd al-Malik b. Nuh, the commander of forces in Khorasan Alp-Tegin along with the vizier Muhammad Bal'ami attempted to place a ruler of their choice on the throne. The attempt failed however and Alp-Tegin decided to withdraw to the eastern fringes of the empire. Per the sources, he wanted to flee to India to avoid his enemies and earn divine merit by raiding the Hindus. He did not intend to capture Ghazni, but was forced to take it when he was denied transit by its ruler.

Alp-Tegin proceeded with his small force of ghulams and ghazis (200 ghulams and 800 ghazis according to Siyasatnama, while Majma al-ansab of Muhammad b. Ali al-Shabankara'i (d. 1358) states 700 ghulams and 2,500 Tajiks). En route, he subdued the Iranian Sher of Bamiyan and the Hindu-Shahi king of Kabul. He then came to Ghazni, whose citadel he besieged for four months and wrested the town from its ruler, Abu 'Ali or Abu Bakr Lawik or Anuk. The origin of this chief was Turkic, though it is not known if he was a Samanid vassal or an independent ruler. Josef Markwart suggests he was a late representative of the Zunbils. The Lawik dynasty of Ghazni was linked to the Hindu Shahi dynasty through marriage. Alp-Tegin was accompanied by Sabuktigin during the conquest of Ghazni.

Minhaj al-Siraj Juzjani states that Alp-Tegin had his position regularised by Amir Mansur b. Nuh through an investiture, however Siyasatnama mentions an expedition against Alp-Tegin from Bukhara which was defeated outside Ghazni. His ambiguous, semi-rebel status seems to be reflected in his coins, with two of his coins minted at Parwan mentioning his authority from the Samanids to mint coins only in an indirect way. He was succeeded by his son Abu Ishaq Ibrahim, who lost Ghazni to Abu Ali Lawik, the son of its expelled ruler. He recovered it however with Samanid help in 964–65.

Alp-Tegin's ghulams were reconciled with the Samanids in 965 but maintained their autonomy. After Ibrahim's death in 966, Bilge-Tigin was made the successor and he acknowledged the Samanids as his overlords. He died in 364 AH (974–975 AD) while besieging Gardez and was succeeded by Böritigin or Piri.

Piri's misrule led to resentment among the people who invited Abu Ali to take back the throne. The Kabul Shahis allied with him and the king, most likely Jayapala, sent his son to assist Lawik in the invasion. According to the Majba al-Ansab, Sabuktigin managed to convince the Muslim Turks living in Ghazni, Gardez and Bamyan to participate in a jihad against the Hindus. When the allied forces reached near Charkh on Logar River, they were attacked by Sabuktigin who killed and captured many of them, while also capturing ten elephants. Lawik as well his ally were both killed in the battle. Piri was expelled and Sabuktigin became governor in 977 AD. The accession was endorsed by the Samanid ruler Nuh II.

Hudud al-‘Alam states that Ghor was under the overlordship of Farighunids. Both Gardezi and Baihaqi state that in 379 AH (979–980 AD), the Samanid Amir Nuh b. Mansur dispatched an expedition under Abu Ja'far Zubaidi to conquer Ghur, but he had to return after capturing several forts. As the Samanid governor of Zabulistan and Ghazni, Sabuktigin attacked it several times. He was able to conquer eastern Ghur after initial set-backs and was acknowledged as a sovereign by Muhammad ibn Suri.

First war against Jayapala
The Ghaznavid campaigns from the time of Sabuktigin are recorded as jihad against the people of al-Hind to destroy idolatry and replace it by expanding Islam. The Kabul Shahis only retained Lamghan in the Kabul-Gandhara area by the time of Alp-Tegin. According to Firishta, Sabuktigin had already begun raiding Multan and Lamghan under Alp-Tegin for slaves. This precipitated an alliance between the Shahi ruler Jayapala, Bhatiya and Sheikh Hamid Khan Lodi. He crossed the Khyber Pass many times and raided the territory of Jaipala.

Jayapala appointed Sheikh Hamid Khan Lodi as ruler over Multan and Lamghan, but Sabuktigin broke up this alliance after his accession through diplomatic means, convincing Lodi to acknowledge him as an overlord. Although Ferishta had identified Lodi and his family as Afghans, historian Yogendra Mishra pointed out that this was an error, since they were descended from the Qurayshite Usama ibn Lawi ibn Ghalib.

Sabuktigin plundered the forts in the outlying provinces of the Kabul Shahi and captured many cities, acquiring huge booty. He also established Islam at many places. Jaipal in retaliation marched with a large force into the valley of Lamghan (Jalalabad) where he clashed with Sabuktigin and his son. The battle stretched on several days until a snow storm affected Jaipala's strategies, forcing him to plead for peace. Sabuktigin was inclined to grant peace to Jayapala but his son Mahmud wanted total victory.

Jaypala upon hearing Mahmud's plans warned Sabuktigin, "You have seen the impetuosity of the Hindus and their indifference to death... If therefore, you refuse to grant peace in the hope of obtaining plunder, tribute, elephants and prisoners, then there is no alternative for us but to mount the horse of stern determination, destroy our property, take out the eyes of our elephants, cast our children into fire, and rush out on each other with sword and spear, so that all that will be left to you to conquer and seize is stones and dirt, dead bodies, and scattered bones." Knowing Jaipala could carry out his threat, Sabuktigin granted him peace in return for his promise of paying tribute and ceding some of his territory.

Second war against Jayapala
After making peace with Sabuktigin, Jayapala returned to Waihind but broke the treaty and mistreated the amirs sent to collect the tribute. Sabuktigin launched another invasion in retaliation. While the mamluks remained the core of his army, he also hired the Afghans, especially the Ghilji tribe, in his dominion. According to al-Utbi, Sabuktigin attacked Lamghan, conquering it and burning the residences of the "infidels", while also demolishing its idol-temples and establishing Islam. He proceeded to slaughter the non-Muslims, destroyed their temples and plundered their shrines. It is said that his forces even risked frostbite on their hands while counting the large booty.

To avenge the savage attack of Sabuktigin, Jayapala, who had earlier taken his envoys as hostage, decided to go to war again in revenge. According to al-Utbi, he assembled an army of 100,000 against Sabuktigin. The much later account of Ferishta states that it included troops from Kanauj, Ajmer, Delhi and Kalinjar. The two sides fought on an open battlefield in Laghman. Sabuktigin divided his army into packs of 500 who attacked the Indians in succession. After sensing that they were weakened, his forces mounted a concerted attack. The forces of Kabul Shahi were routed and those still alive were killed in the forest or drowned in the river.

The second battle that took place between Sabuktigin and Jayapala in 988 AD, resulted in the former capturing territory between Lamghan and Peshawar. Al-Utbi also states that the Afghans and Khaljis, living there as nomads, took the oath of allegiance to him and were recruited into his army. He helped Nuh II in expelling the rebel and heretic Abu Ali Simjur from Khorasan, resulting in its governorship being given to Sabuktigin who appointed Mahmud as his deputy there. He also appointed Ismail as the successor to his kingdom and died in 997. A succession war erupted between Ismail and Mahmud, with the latter gaining the throne in 998.

Mahmud

The Samanid amir Mansur II appointed Bektuzun as Khorasan's governor after Sabuktigin's death. Mahmud however wished to reacquire the governorship after defeating his brother Ismail and his allies. Bektuzun and Fa'iq, the de facto power behind the Samanid throne, toppled Mansur II as they did not trust him, and replaced him with Abu'l Fawaris 'Abd al-Malik. Their forces were however defeated in 999 by Mahmud, who acquired all the lands south of Oxus, with even those to the north of the river submitting to him. The Samanid dynasty was later ended by the Karakhanids. In 1002, Mahmud also defeated the Saffarid Amir Khalaf ibn Ahmad and annexed Sistan.

Wars against Kabul Shahi
Mahmud systemized plunder raids into India as a long-term policy of the Ghaznavids. The first raid was undertaken in September 1000, but was meant for reconnaissance and identifying the possible terrain and roads that could be used for future raids. He reached Peshawar by September 1001 and was attacked by Jayapala. The two sides clashed on 27–28 November 1001 and Jayapala was captured. Anandapala who was at Waihind, had to pay a heavy ransom to have his father and others released. Jayapala later self-immolated out of shame and Anandpala succeeded him. Mahmud attacked Anandpala later over his refusal to allow him passage during his attack on Multan, which was controlled by Fateh Daud. The two sides clashed in 1009 in the eastern side of Indus at Chhachh, with Mahmud defeating Anandapala and capturing the fort of Bhimnagar. He was allowed to rule as a feudatory in Punjab for some time.

An alliance between Anandpala's son, Trilochanpala, and Kashmiri troops was later defeated. During the warfare from 990–91 to 1015, Afghanistan, and later Punjab and Multan were lost to the Ghaznavids. Trilochanpala's rule was limited to eastern Punjab and he gained respite from the Muslim invasions with retreat to Sirhind. He allied with the Chandellas and in 1020-21 was defeated at a river called Rahib by Al-Utbi, while Firishta and Nizamuddin Ahmad identify it as Yamuna. He was killed in 1021 AD by his mutinous troops and succeeded by Bhimapala, who became the last ruler of the Kabul Shahi and was killed fighting the Ghaznavids in 1026 AD. The remnants of the royal family sought refuge with the Lohara dynasty of Kashmir and Punjab passed under the control of Muslim conquerors.

Mahmud used his plundered wealth to finance his armies which included mercenaries. The Indian soldiers, presumably Hindus, who were one of the components of the army, with their commander called sipahsalar-i-Hinduwan, lived in their quarter of Ghazni while practicing their own religion. Indian soldiers under their commander Suvendhray remained loyal to Mahmud. They were also used against a Turkic rebel, with the command given to a Hindu named Tilak according to Baihaki.

The renowned 14th-century Moroccan Muslim scholar Ibn Battuta remarked that the Hindu Kush meant the "slayer of Indians", because the slaves brought from India who had to pass through there died in large numbers due to the extreme cold and quantity of snow. He states:

Invasions of Ghur

The conversion of Ghur occurred over a long period and it was mostly pagan until the 10th century, which Mohammad Habib and Khaliq Ahmad Nizami say was probably a result of the missionary activities by the Karramiyya movement established in the region in 10th–11th centuries. Its imperfect conversion is visible by the fact that while the people of Ghur had Muslim names, they led the life of pagans. Muhammad b. Suri, who had acknowledged Sabuktigin as his sovereign, withheld tribute after his death, started plundering caravans and harassed the subjects of Mahmud. Rawżat aṣ-ṣafāʾ called him a pagan, and al-Utbi stated that he was a Hindu.

In 1011, Mahmud dispatched an expedition to conquer Ghur under Altuntash, governor of Herat, and Arslan Hajib, governor of Tus. Muhammad b. Suri, the king, placed himself in inaccessible hills and ravines. The Ghurids were however defeated and Suri was captured along with his son Shith. Abu Ali, who had remained on good terms with the Sultan, was made the ruler of Ghur by him. Eastern Ghur was brought under Ghaznavid control. In 1015, Mahmud attacked Ghur's southwestern district of Khwabin and captured some forts.

In 1020, Mahmud's son Ma'sud was dispatched to take Ghur's northwestern part called Tab. He was helped by Abul Hasan Khalaf and Shirwan, chieftains of the south-western and north-eastern regions respectively. He captured many forts, bringing the entire region of Ghur, except maybe the inaccessible interior, under Ghaznavid control. He also captured the stronghold of the chieftain Warmesh-Pat of Jurwas, levying a tribute of arms. Minhaj al-Siraj Juzjani praises Abu Ali for firmly establishing Islamic institutions in Ghur. The progress of Islam in this divided region after his death is however unknown.

Ghur remained a pagan enclave until the 11th century. Mahmud who raided it, left Muslim precepts to teach Islam to the local population. The region became Muslim by 12th century, though the historian Satish Chandra states that Mahayana Buddhism is believed to have existed until the end of the century. Neither Mahmud nor Ma'sud conquered the interior. Habib and Nizami say that the Ghurids were gradually converted by propagandists of new mystic movements. The Shansabani eventually succeeded in establishing their seniority in Ghor, if not its unification. By the time of Sultan Bahram, Ghur was converted and politically unified. According to Minhaj, both Ghiyasuddin and Mu'izzuddin were Karamis who later converted to Shafi‘i and Hanafi Islam respectively. Tarikh-i guzida however says that the Ghorids were only converted to Islam by Mahmud.

Conversion of Pashtun-Afghan people
The name Afghanistan was first used in a political sense by Saifi Herawi in the 14th century. It was even used during the height of the Durrani Empire. Only after the Durand line was fixed, did its modern usage for the land between it and the Oxus river became usual. The people who were mostly responsible for establishing the Afghan kingdom are referred to as Pashtun, who were also called "Afghans". The name Pashtun (or Pakthun) is the original and oldest name.

The tenth-century Persian geography Hudud al-'Alam is the earliest known mention of the Afghans. In Discourse on the Country of Hindistan and Its Towns, he states that, "Saul, a pleasant village on a mountain. In it live Afghans." Ibn Battuta described Saul as being situated between Gardez and Husaynan along a common trade route, the exact location of Husaynan is unknown. Akhund Darweza states that their original homeland was Qandahar from where they migrated in 11th century upon the request of Mahmud of Ghazni to assist him in his conquests. Afghan tradition considers "Kase Ghar" in Sulayman range as the homeland. Hudud al-'Alam also mentions that the king of Ninhar (Nangarhar) had many wives including "Moslem, Afghan and Hindu".

The Pashtun traditions speak of Islamization during Muhammad's time through Khalid ibn al-Walid. Qais Abdur Rashid, the presumed ancestor of the Afghans, is said to have led a delegation to Mecca from Ghor after being summoned by Khalid b. Walid and converted to Islam while also distinguishing himself in the service of Muhammad. He adopted the name Abdul Rashid, and his three sons – Saraban, Ghurghust, Karlani, and a foundling Karlanri linked to Saban, are considered to be the progenitors of the major Afghan divisions.

Ni'matullah's Makhzan-i-Afghani traces their history to an Israelite called Afghana who constructed the al-Aqsa mosque. Per it, under the time of King Suleiman, a figure named Bokhtnasser was responsible for "carrying away the Israelites, whom he settled in the mountainous districts of Ghor, Ghazneen, Kabul, Candahar, Koh Firozeh, and the parts lying within the fifth and sixth climates; where they, especially those descended of Asif and Afghana, fixed their habitations, continually increasing in number, and incessantly making war on the infidels around them." Qais traveled to Medina to receive Mohammed's blessings and fought against the Meccans. Muhammad himself conferred the title of Pashtun upon Qais and his people according to the tradition. They returned to Ghor to spread Islam and pledged loyalty to Mahmud. Per Ni'matullah, the Ghurid ruler Mu'izz al-Din had initiated their eastward migration into present-day north-west Pakistan, in course of his military campaigns.

The Arabs, at war with the Kabul Shah, had directed their campaigns in direction of Gandhara. By the time of Mu'awiya, Sistan's governorship was separated from Khorasan, with the governor looking after the region and keeping a check on Kabul Shah. Ahmed Hassan Dani considered that the Arab activities may have led to conversion of Aghans as well, and it may have been wholesale because of their tribal nature, i.e., all the Afghan tribes adopted Islam at once.

Quoting Matla-al-Anwar, Ferishta states that a man named Khalid, son of Abdullah, stated by some to be a descendant of Khalid bin Walid or Abu Jahl, was for some time governor of Herat, Ghor, Gharjistan and Kabul. After being relieved of the charge, he settled in Koh Sulaiman, with the Lodis and Suris being the descendant of his daughter who married a converted Afghan.

Al-Utbi in Tarikh-i-Yamini states that the Afghans were enlisted by Sabuktigin and also Mahmud. During this period, the Afghan habitat was in the Sulaiman Mountains. After defeating Jayapala in 988 AD, Sabuktigin had acquired the territory between Laghman and Peshawar. Al-Utbi states that the Afghans and Khaljis, living there as nomads, took the oath of allegiance to him and were recruited into his army. Iqtidar Husain Siddiqui citing a 13th-century Persian translation, claims he mentions the "Afghans" were pagans given to rapine and rapacity, they were defeated and converted to Islam.

Writing in the 11th century AD, Al-Biruni in his Tarikh al Hind stated that the Afghan tribes lived in mountains west of India. He notes, "In the western frontier mountains of India there live various tribes of the Afghans and extend up to the neighbourhood of the Sindu valley." He earlier also noted about the mountains, "In marching from our country to Sindh we start from the country of Nimroz, i.e. the country of Sijistan, whilst marching to Hind or India proper we start from the side of Kabul... In the mountains which form the frontier of India towards the west there are tribes of the Hindus, or of people near akin to them  — rebellious savage races — which extend as far as the farthermost frontiers of the Hindu race."

Mahmud had gone to war against pagan Afghans while campaigning in the Sulayman mountains. Firishta states that Afghans fought on both sides during the war between Mu'izz al-Din and Pithorai in 1192 AD, which Encyclopaedia of Islam says probably indicates that they were not completely converted yet.

In 1519, Babur mounted an attack on the fort of Bajaur and sent a Dilazak Afghan as an ambassador to the Gibri Sultan of Bajaur, Mir Haidar 'Ali, to surrender and enter his services. Gibri, a Dardic language of Bajaur, was also spoken by the royal family and nobility of the Swat Valley. The Gibris decided to resist and Babur's forces stormed it in two days. He ordered a general massacre of its inhabitants on the pretext that they had rebelled against Kabul's regime and were infidels who had forsaken Islam.

The westward migration of Pashtuns from Sulaiman mountains to Qandahar and Herat is thought to have begun in the 15th century. In the 16th century, the area around Qandahar formed a bone of contention between the Ghilzais and Abdalis. The latter gave in and migrated to Herat during the reign of Safavid Shah Abbas I. Their migration displaced or subjugated the indigenous populations, especially the Tajiks who were also the dominant population in Kabul, Nangarhar and Laghman in east Afghanistan. Before the advent of Ghilzais of the Ahmadzai division in the late 16th century, Logar River was also a Tajik stronghold. The Pashtuns also displaced the original Kafirs and Pashayi people in Kunar Valley and Laghman Valley, located south of Kabul in east Afghanistan, to the infertile mountains. Regions to the south and east of Ghazni were the strongholds of Hazaras before the 16th century. They also lost Wardak to the tribe of the same name when the latter invaded in the 17th century. In Qandahar, the Farsiwanis, Hazaras, Kakars and Baloch people were subjugated.

Conquests of Kafiristan

Kafiristan is a mountainous region of the Hindu Kush that was isolated and politically independent until the Afghan conquest of 1896. Before their conversion to Islam, the Nuristanis or Kafir people practiced a form of ancient Hinduism infused with locally developed accretions.

Kafiristan proper from west to east comprises basins of Alishang, Alingar, Pech or Prasun, Waigal and Bashgal. The region became a refuge of an old group of Indo-European people, probably mixed with an older substratum, as well as a refuge of a distinct Kafiri group of Indo-Iranian languages, forming part of the wider Dardic languages. The inhabitants were known as "kafirs" due to their enduring paganism, while other regions around them became Muslim. However, the influence from district names in Kafiristan of Katwar or Kator and the ethnic name Kati has also been suggested. The Kafirs were divided into Siyah-Posh, comprising five sub-tribes who spoke the Kamkata-vari language; while the others were called Safed-Posh, comprising Prasungeli, Waigeli, Wamai and Ashkun.

The Kafirs called themselves "Balor", a term that appeared in Chinese sources as early as the fifth century AD. In both the Chinese sources and Muslim sources like the 16th-century work of Kashmir's conqueror Mirza Muhammad Haidar Dughlat, the terms "Bolor" and "Boloristan" denote the area from the Kabul valley to Kashmir, Yarkand and Kashgar. The country is the most inaccessible part of Hindu Kush. The Muslim conquerors could not achieve a lasting success here.

The vast area extending from modern Nuristan to Kashmir contained a host of "Kafir" cultures and Indo-European languages that became Islamized over a long period. Earlier, it was surrounded by Buddhist areas. The Islamization of the nearby Badakhshan began in the 8th century and Peristan was completely surrounded by Muslim states in the 16th century with the Islamization of Baltistan. The Buddhist states temporarily brought literacy and state rule into the region. The decline of Buddhism resulted in it becoming heavily isolated.

There have been varying theories about the origins of the Kafirs. Oral traditions of some Nuristanis place themselves to be at confluence of Kabul and Kunar River a millennium ago, being driven off from Kandahar to Kabul to Kapisa to Kama with the Muslim invasion. They identify themselves as late arrivals here, being driven by Mahmud of Ghazni, who after establishing his empire, forced the unsubmissive population to flee. George Scott Robertson considered them to be part of the old Indian population of Eastern Afghanistan and stated that they fled to the mountains while refusing to convert to Islam after the Muslim invasion in the 10th century. The name Kator was used by Lagaturman, the last king of the Turk Shahi. The title "Shah Kator" was assumed by Chitral's ruler Mohtaram Shah who assumed it upon being impressed by the majesty of the erstwhile pagan rulers of Chitral. The theory of Kators being related to the Turki Shahis is based on the information of Jami- ut-Tawarikh and Tarikh-i-Binakiti. The region was also named after its ruling elite. The royal usage may be the origin behind the name of Kator.

Mahmud of Ghazni
In 1020–21, Mahmud of Ghazni led a campaign against Kafiristan and the people of the "pleasant valleys of Nur and Qirat" according to Gardizi. The Persian chronicles speak of Qirat and Nur (or Nardin), which H. M. Elliot on authority of Al-Biruni identifies with Nur and Kira tributaries of Kabul river. Ferishta wrongly calls these two valleys as "Nardin" and Qirat and confuses this conquest with the one against "Nardin" or Nandana. He also wrongly mentions that it took place after 412 AH. Alexander Cunningham identifies the places conquered as "Bairath" and "Narayanpura".

These people worshipped the lion. While Clifford Edmund Bosworth considers that Mahmud attacked "pagan Afghans", Joseph Theodore Arlinghaus of Duke University does not consider it correct because his source Gardizi simply calls them "pagan (kafiran)" and not "pagan Afghans", as they were not known to be pagan or live on borders of Nuristan in the 11th century. Mohammad Habib however considers that they might have been worshipping Buddha in the form of a lion (Sakya Sinha). Ramesh Chandra Majumdar states that they had a Hindu temple which was destroyed by Mahmud's general. Ram Sharan Sharma meanwhile states that they may have been Buddhist. Cunningham claims based on the reporting of Ferishta that the place was plundered by 'Amir Ali after being taken.

According to Gardizi, while returning from his recent invasion of India, Mahmud had heard about the Kafirs and the chief of Qirat surrendered without any struggle and accepted to convert, with the inhabitants converting as well. Nur however refused to surrender and his general 'Amir Ali led an attack on it, forcing its people to convert. According to Firshta, the rulers of both of them submitted and accepted Islam in 1022. He adds, "On breaking a great temple situated there, the ornamented figure of a lion came out of it, which according to the belief of the Hindus was four thousand years old."

However, no permanent conquest was attempted. Iqbal namah-i-Jahangiri stated that Kafirs still lived in Darrah-i-Nur which Mahmud of Ghazni had claimed to have converted. The Mughal Emperor Jahangir had received a delegation of these pure Kafirs in Jalalabad and had honoured them with gifts.

Timurids

The campaigns of Timur are recorded by Zafarnama, written by Sharaf ad-Din Ali Yazdi, which is based on another work. On his way to India, Timur attacked the Siyah-Posh in 1398 AD after receiving complaints from the trading city of Andarab about the raids by the Kafirs. He penetrated Kafiristan from Khawak pass and restored an old fortress there. He personally proceeded against the Kator region, which extended from Kabul to Kashmir.

Timur sent a detachment of 10,000 soldiers against the Siyah-Poshas under Burhan Aglan and had the fort of Kator deserted by Kafirs destroyed, while the houses of the city were burnt. The Kafirs took refuge on top of a hill and many were killed in the ensuing clash. Some held out for three days but agreed to convert after Timur offered them the choice between death and Islam. They however soon apostatised and ambushed Muslim soldiers in the night. The Muslims repelled them and a number of the Kafirs were killed, with 150 being taken prisoner and later executed. Timur ordered his men "to kill all the men, to make prisoners of women and children, and to plunder and lay waste all their property." His soldiers carried out the order and he directed them to build a tower of skulls of the dead Kafirs.

Timur had his expedition engraved on a neighbouring hill in the month of Ramadan. His detachment sent against the Siyah-Poshas however met with disaster, with Aglan being routed and forced to flee. A small detachment of 400 men under Muhammad Azad was then sent and defeated the Kafirs, retrieving the horses and armour Aglan lost. Timur later captured a few more places, though nothing more is stated, presumably he left the Siyah-Poshas alone. He proceeded to exterminate the rebellious Afghan tribes and crossed the Indus River in September 1398.

The Timurid Sultan Mahmud Mirza is said to have raided Kafiristan twice by Baburnama, which earned him the title of ghazi.

Yarkand Khanate
Mirza Muhammad Haidar Dughlat invaded Balor under orders of Sultan Said Khan in 1527-1528 AD, and was accompanied by Said's eldest son Rashid Khan. The expedition was an Islamic frontier raid called ghaza. Dughlat undertook highly devastating plundering raids against the region.

Rashid Khan (r. 1533–1569) undertook further expeditions against Bolor (Kafiristan), which are recorded by Tarikh-i-Kashgar and Bahr al-asar of Mahmud b. Amir Wali. The Kashgari author mentions it briefly, though Wali goes into detail. The first campaign failed with a number of Kashgari captured and enslaved by the people of Bolor. A second invasion was successful and forced them to submit. Tarikh-i-Kashgar states that Bolor was governed by Shah Babur after Abdullah Khan's successful campaign in 1640.

Mughals
Babur himself came to the region in the winter of 1507–1508 and had an inscription carved commemorating his transit. While fleeing to India to take refuge in the Afghan-Indian borderlands after Shibani Khan attacked Qandahar, which Babur had recently conquered, he marched from Kabul to Lamghan in September 1507. He eventually reached the Adinapur fort in Nangarhar district and commented that his men had to forage for food and raided the rice fields of the Kafirs in the Alishang district.

While writing in his memoirs, Babur noted that when he captured Chigha Sarai in 1514, the "Kafirs of Pech came to their assistance." He mentions some Muslim nīmčas or half-breeds, probably converted Kafirs, who married with the Kafirs and lived at Chigha Sarai, located at confluence of Kunar River and Pech River. In 1520, he mentions sending Haidar Alamdar to the Kafirs, who returned and met him under Bandpakht along with some Kafir chiefs who gifted him some wineskins.

The relationship between the Siahposh and the residents of Panjshir and Andarab remained the same even more than a century after Timur's expedition. Babur records about Panjshir that, "It lies upon the road, and is in the immediate vicinity of Kafiristan. The inroads of the robbers of Kafiristan are made through Panjshir. In consequence of their vicinity of the Kafirs - the inhabitants of this district are happy to pay them a fixed contribution. Since I last invaded Hindustan, and subdued it (in 1527), the Kafirs have descended into Panjshir, and returned after slaying a great number of people and committing extensive damages."

Per Tabakat-i-Akbari, the Mughal Emperor Akbar had dispatched his younger brother Mirza Muhammad Hakim, who was a staunch adherent of the missionary-minded Naqshbandi Sufi order, against the Kafirs of Katwar in 1582. Hakim was a semi-independent governor of Kabul. The Sifat-nama-yi Darviš Muhammad Hān-i Ğāzī of Kadi Muhammad Salim who accompanied the expedition mentions its details and gives Hakim the epithet of Darviš Khan Gazi.

Muhammad Darvish's religious crusade fought its way from Lamghan to Alishang, and is stated to have conquered and converted 66 valleys to Islam. After conquering Tajau and Nijrau valleys in Panjshir area, his forces established a fort at Islamabad, located at the confluence of Alishang and Alingar rivers. They continued the raid up to Alishang and made their last effort against the non-Muslims of Alingar, fighting up to Mangu, the modern border between Pashai and Ashkun-speaking areas.

The conquest does not seem to have had a lasting effect, as Henry George Raverty mentions that Kafirs still lived in upper part of Alishang and Tagau. Khulasat al-ansab of Hafiz Rahmat Khan stated that the Afghans and Kafirs of Lamghan were still fighting each other during the time of Jahangir.

Final subjugation

Under Amir Sher Ali Khan, Afghanistan was divided into provinces (wilayats) of Kabul, Kandahar, Herat and Afghan Turkestan. Uruzgan and Kafiristan were later incorporated into Kabul. Some parts of Kafiristan were already following Islam before its conquest. Amir Abdul Rahman Khan tried to persuade them to convert to Islam by deputing Kafir elders. The Kafirs were meanwhile poorly armed as compared to Afghans and numbered only 60,000. By 1895, the demarcation of nearby Chitral under indirect British rule, and the conquest of Pamirs by Russia, worried him about the endangerment of integration of Afghanistan through the independent Kafiristan. Afghan tribes meanwhile undertook slave raids in places like Kafiristan, Hazarajat, Badakhshan and Chitral.

The territory between Afghanistan and British India was demarcated between 1894 and 1896. Part of the frontier lying between Nawa Kotal in outskirts of Mohmand country and Bashgal Valley on outskirts of Kafiristan were demarcated by 1895 with an agreement reached on 9 April 1895. Abdur Rahman wanted to force every community and tribal confederation with his single interpretation of Islam due to it being the only uniting factor. After the subjugation of the Hazaras, Kafiristan was the last remaining autonomous part. Field marshal Ghulam Hayder Khan sent a message to Kafirs of Barikut which stated, "It is not the duty of the government to compel, force or impose on them to accept, or take the path of the religion of Islam. The obligation that does exist is this: they render obedience and pay their taxes. As long as they do not disobey their command, they will not incinerate themselves with the fire of padishah's [king's] wrath. In addition, they are not to block the building of the road [that was planned through their territory]."

Emir Abdur Rahman Khan's forces invaded Kafiristan in the winter of 1895–1896 and captured it in 40 days according to his autobiography. Columns invaded it from the west through Panjshir to Kullum, the strongest fort of the region. The columns from the north came through Badakhshan and from the east through Asmar. A small column also came from south-west through Laghman. The Kafirs were forcibly converted to Islam and resettled in Laghman, while the region was settled by veteran soldiers and other Afghans. Kafiristan was renamed as Nuristan. Other residents also converted to avoid the jizya.

His victory was celebrated with the publishing of a poem in 1896 or 1897 and Faiz Mohammad Katib Hazara gave him the title of "Idol-Smasher". About 60,000 of the Kafirs became converts. Mullahs were deployed after the conquest to teach them about fundamentals of Islam. The large-scale conversion proved difficult however and complete Islamization took some time. Kafir elders are known to have offered sacrifices in their shrines upon hearing rumours of Rahman's death in 1901. Three main roads connecting Badakhshan with Kunar and Lamghan (Chigha Sirai-Munjan, Asmar-Badakhshan and Munjan-Laghman) were built after the conquest.

title: Muslim conquests of Afghanistan