The first references to ancient Kapisa, or the present-day Bagram town of the Parwan Province of Afghanistan, appear in the writings of 5th-century BCE Indian scholar Achariya Pāṇini. Pāṇini refers to the city of Kapiśi, a city of the Kapisa kingdom. Pāṇini also refers to Kapiśayana, a famous wine from Kapisa. The city of Kapiśi also appeared as Kaviśiye on Graeco-Indian coins of Appolodotus/Eucratides.
Archeology discoveries in 1939 confirm that the city of Kapisa was an emporium for Kapiśayana wine, discovering numerous glass flasks, fish-shaped wine jars, and drinking cups typical of the wine trade of the era. The grapes (Kapiśayani Draksha) and wine (Kapiśayani Madhu) of the area are referred to by several works of ancient Indian literature. The Mahabharata also noted the common practice of slavery in the city.
In later times, Kapisa seems to have been part of a kingdom ruled by a Buddhist Kshatriya king holding sway over ten neighboring states including Lampaka, Nagarahara, Gandhara and Banu, according to the Chinese pilgrim Hiuen Tsang who visited in 644 AD. Hiuen Tsang notes the Shen breed of horses from the area, and also notes the production of many types of cereals and fruits, as well as a scented root called Yu-kin.
Kapisa is related to and included Kafiristan. Scholar community holds that Kapisa is equivalent to Sanskrit Kamboja. In other words, Kamboja and Kapisa are believed to be two attempts to render the same foreign word (which could not appropriately be transliterated into Sanskrit). Dr S Levi further holds that old Persian Ka(m)bujiya or Kau(n)bojiya, Sanskrit Kamboja as well as Kapisa, all etymologically refer to the same foreign word.
Even the evidence from 3rd-century Buddhist tantra text Mahamayuri (which uses Kabusha for Kapisha) and the Ramayana-manjri by Sanskrit Acharya, Kshemendra of Kashmir (11th century AD), which specifically equates Kapisa with Kamboja, thus substituting the former with the latter, therefore, sufficiently attest that Kapisa and Kamboja are equivalent. Even according to illustrious Indian history series: History and Culture of Indian People, Kapisa and Kamboja are equivalent. Scholars like Dr Moti Chandra, Dr Krishna Chandra Mishra etc. also write that the Karpasika (of Mahabharata) and Kapisa (Ki-pin/Ka-pin/Chi-pin of the Chinese writings) are synonymous terms.
Thus, both Karpasika and Kapisa are essentially equivalent to Sanskrit Kamboja. And Pāṇinian term Kapiśi is believed to have been the capital of ancient Kamboja. Kapisa (Ki-pin, Ke-pin, Ka-pin, Chi-pin of the Chinese records), in fact, refers to the Kamboja kingdom, located on the south-eastern side of the Hindukush in the Paropamisadae region. It was anciently inhabited by the Aśvakayana (Greek: Assakenoi), and the Aśvayana (Greek Aspasio) (q.v.) sub-tribes of the Kambojas. Epic Mahabharata refers to two Kamboja settlements: one called Kamboja, adjacent to the Daradas (of Gilgit), extending from Kafiristan to south-east Kashmir including Rajauri/Poonch districts, while the original Kamboja, known as Parama Kamboja was located north of Hindukush in Transoxiana territory mainly in Badakshan and Pamirs/Allai valley, as neighbors to the Rishikas in the Scythian land. Even Ptolemy refers to two Kamboja territories/and or ethnics - viz.: (1) Tambyzoi, located north of Hindukush on Oxus in Bactria/Badakshan and (2) Ambautai located on southern side of Hindukush in Paropamisadae. Even the Komoi clan of Ptolemy, inhabiting towards Sogdiana mountainous regions, north of Bactria, is believed by scholars to represent the Kamboja people.
Front ranking scholars like Dr S. Levi, Dr Michael Witzel and numerous others accept the identity of Tambyzoi and Ambautai with Sanskrit Kamboja. Obviously, the Ptolemian Ambautai formed parts of the Kapisa kingdom under sway of Aśvakayana/Aśvayana (Aśvaka) Kambojas. It appears probable that the original home of the Kambojas was trans-Oxian Kamboja, from where, some tribal sections moved south-wards and planted colonies in Paropamisan on southern side of Hindukush. With passage of time, the Paropamisan settlements came to be addressed as Kamboja proper, whereas the original Kamboja settlement lying north of Hindukush, in Transoxiana, became known as 'Parama-Kamboja' i.e. furthest Kamboja. Some scholars call Parama Kamboja as 'Uttara-Kamboja' i.e. northern Kamboja or Distant Kamboja. The Kapisa-Kamboja equivalence as suggested by scholars like Dr Levi applies to the Paropamisan Kamboja settlement.
According to the conventional etymology, the name "Kafir" derives from Arabic Kafir, commonly translated into English as "infidels" or "idolaters". Kafiristan then would be "The Land of the Infidels". This explanation would justify the renaming of the country after its Islamization.
Many historians, however, opine that the local name "Kafir" comes from Kapiśa (= Kapisha), the ancient Sanskrit name of the region that included historic Kafiristan; which is also given as "Ki-pin" (or Ke-pin, Ka-pin, Chi-pin) in old Chinese chronicles. That name, unrelated to the Arabic word, is believed to have, at some point, mutated into the word Kapir. This linguistic phenomenon is not unusual for this region. The name of King Kanishaka, who once ruled over this region, is also found written as "Kanerika", an example of "ś" or "sh" mutating to "r". In a similar way, Kapiś – the name of the people of Kapiś/Kapiśa, is believed to have changed to Kapir and then Kafir. One of the dominant clan of the Kafirs till recently was known as Katir.
The second change from Kapir to Kafir may have been the result of confusion or intentional wordplay with the Arabic word, since the Kafirs were indeed pagans until 1895. Kafiristan then derives from -stan which in Iranian language means country, abode or place. Thus, Kafiristan would literally mean the land or abode of the Kafir (Kapir) peoples i.e. people belonging to Kapiśa.
Today it is disputed if the term Kafir really defines a traditional ethnic group.
Although Kapisa was within the boundaries of Aryan communities, what today is Afghanistan was also invaded several times by Turks/Tokhars, Scytho-Sarmatians, Greeks, and others.
It is believed that many of the inhabitants of Kapisa were non-Aryan cannibals (Pisachi). They are described as piśitāśana or 'flesh-eating'. The fact that cannibalism existed around the region is testified by Roman scholar Pliny the Elder, who mentions the Tocharians as cannibals.
Hiuen Tsang says that "the people of Kapiśa (Kai-pi-chi(h)) are cruel and fierce; their language is coarse and rude. Their marriage ceremonies are mere intermingling of sexes. Their literature is like that of Tukhara country but the customs, the common language, and rule of behavior are somewhat different. For clothing they use hair garments (wool); their garments are trimmed with furs. In commerce, they use gold and silver coins and also little copper coins. Hiuen Tsang further writes that the king of Kapisa is Kshatriya by caste. He is of shrewd character (nature) and being brave and determined, he has brought into subjection the neighboring countries, some ten of which he rules ".
According to scholars, much of the description of the people from Kapiśa to Rajapura as given by Hiuen Tsang agrees well with the characteristics of the Kambojas described in the Buddhist text, Bhuridatta Jataka as well in the great Indian epic Mahabharata. Moreover, the Drona Parava of Mahabharata specifically attests that Rajapuram was a metropolitan city of the epic Kambojas. The Rajapuram (=Rajapura) of Mahabharata (Ho-b-she-pu-lo of Hiuen Tsang) has been identified with modern Rajauri in south-western Kashmir. Culturally speaking, Kapiśa had significant Iranian influence.
The affinities of the earlier Shahi rulers (the so-called Turk Shahis) of Kapisa/Kabul, who are believed to have probably ruled from the early 5th century till 870 AD, are still not clear. The different scholars link their affinities to different ethnics. 11th-century Muslim histriographer Alberuni's confused accounts on the early history of Shahis based mainly as they are on folklore, do not inspire much confidence on the precise identity of the early Shahis of Kapisa/Kabul. They call them as Hindus on the one hand and claim their descent from the Turks, while at the same time, they also claim their origin/descent from Tibet.
Dr V. A. Smith calls the early Shahis as a Cadet Branch of the Kushanas. H. M. Elliot identifies them with Kators/Katirs and further link them to Kushans. George Scott Robertson writes that the Kators/Katirs of Kafiristan belong to the well known Siyaposh tribal group of the Kams, Kamoz and Kamtoz tribes. Charles Fredrick Oldham identifies them with Naga-worshiping Takkas or Kathas and groups the Naga-cum-Sun worshipping Urasass (Hazaras), Abhisaras, Gandharas, Kambojas and Daradas collectively as the representatives of the Takkas or Kathas. Dr D. B. Pandey traces the affinities of the early Kabul Shahis to the Hunas. Bishan Singh and K. S. Dardi etc. connect the Kabul Shahis to the ancient Kshatriya clans of the Kambojas/Gandharas. 7th-century Chinese pilgrim Hiuen Tsang, who visited INdis (629 AD - 645 AD) calls the ruler of Kapisa as Buddhist and of a Kshatriya caste.
Kalhana, the 12th-century Kashmirian historian and author of the famous Rajatarangini, also calls the Shahis of Gandhara/Waihind as Kshatriyas. These early references link this Kshatriya ruler and his dynasty undoubtedly to the Indo-Iranian Aryan lineage. Further, though Kalhana takes the history of the Shahis to as early as or even earlier than 730 century AD, but very interestingly, he does not refer to any supplanting of the Shahi dynasty at any time in the entire history of the Shahis.
It is also worth mentioning here that the ancient Indian sources like Pāṇini's Astadhyayi, Harivamsa, Vayu Purana, Manusmriti, Mahabharata, Kautiliya's Arthashastra etc. etc. call the Kambojas and the Gandharas as Kshatriyas. According to Olaf Caroe, the earlier Kabul Shahis, in some sense, were the inheritors of the Kushana-Hephthalite chancery tradition and had brought in more Hinduised form with time. There does not yet exist in the upper Kabul valley any documentary evidence or any identifiable coinage which can establish the exact affinities of these early Shahis who ruled there during the first two Islamic centuries.
Obviously, the affinities of the early Shahis of Kapisa/Kabul are still speculative, and the inheritance of the Kushan-Hephthalite chancery tradition and political institutions by Kabul Shahis do not necessarily connect them to the preceding dynasty i.e. the Kushanas or Hephthalites. From the 5th century to about 794 AD, their capital was Kapisa, the ancient home of the cis-Hindukush Kambojas – popularly also known as Ashvakas. After the Arab Moslems began raiding the Shahi kingdom, the Shahi ruler of Kapisa moved their capital to Kabul (until 870 AD). Alberuni's accounts further claim that the last king of the early Shahiya dynasty was king Lagaturman (Katorman) who was overthrown and imprisoned by his Brahmin vizier called Kallar. Alberuni's reference to the Brahman vizier as having taken over the control of the Shahi dynasty, in fact, may be a reference to Kallar (and his successors) as having been followers of Brahmanical religion in contrast to Shahi Katorman (Lagaturman) or his predecessors Shahi rulers, who were undoubtedly staunch Buddhists. It is very likely that a change in religion may have been confused with change in dynasty. In any case, this started the line of so-called Hindu Shahi rulers, according to Alberuni's accounts.
See the main article: Shahi
It was part of Delhi Sultanate, Khilji dynasty in particular.
Scholars have identified the former Kafir clans of the Kams, Kamoje/Kamoz, Kamtoz etc. (or modern Nuristanis) as the relics of the ancient Kapiśas i.e. Kambojas of the Paropamisan region. Similarly, the former Kafirs like Aspins of Chitral and Ashkuns or Yashkuns of Gilgit are identified as the modern representatives of the Pāṇinian Aśvakayanas (Greek: Assakenoi) and the Asip/Isap or Yusufzai (from Aspazai) in the Kabul valley (between river Kabul and Indus) are believed to be modern representatives of the Pāṇinian Aśvayanas (Greek: Aspasio) respectively.
The Aśvakayanas and Aśvayanas are also believed to be sub-tribes of Paropamisan Kambojas, who were exclusively engaged in horse breeding/trading and also formed a specialised cavalry force.