Emergence of Afghanistan as a Political Entity and the Use of Polity Names
Modern Afghanistan is frequently considered to have been founded in 1747 by Aḥmad Shāh, portrayed by the 20th century historians as the founder of a Pashtun nation state, who was 'democratically' elected in an assembly in Kandahar to rule over his tribe, the Abdālī (then renamed to Durrānī). In reality though, Aḥmad Shāh never claimed to be king or emperor of the Afghans, i.e. Pashtuns, only — nor did he limit his activities to the Pashto-speaking provinces of either Iran or India. Instead, he considered himself a successor of Nādir Shāh (of Iran), largely continuing the pre-existing administrative structures and grabbing as many provinces as possible, with little regard to their ethno-linguistic or religious composition. Many military campaigns were directed well beyond the Pashtun homelands into the provinces of the Panjab and Kashmir in (Mughal) India.
The polity thus carved out of erstwhile territories of Iran, India and Uzbekistan by Aḥmad Shāh was — again in the tradition of many earlier dynastic realms — normally called either Dawlat-i ʿalīyah-ʾi Durrānīyah (دولت علیّهٔ درانیّه), the high (or sublime) Durrānī State, or Mamālik-i maḥrūsah-ʾi Durrānīyah (ممالک محروسهٔ درانیّه), the guarded (or protected) realms (or dominions) of the Durrānī, much like e.g. the Ottoman Empire. Adjectives other than ʿalīyah, high or sublime, like qāhirah (قاهره), which means overpowering, irresistible or victorious, can also be found used in political treaties of the time. Frequent succession struggles among the heirs and the tribal factions supporting the contenders, combined, i.a., with the inability to maintain control over the Indian provinces gradually weakened this polity.
The deposition and subsequent execution of Maḥmūd Shāh's chief minister Fatḥ Khān (فتح خان), who was titled Shāh Dūst (شاه دوست), and headed the Muḥammadzāʾī (محمدزائی; Pashto: Muḥammadzay, محمدزی) clan of the Bārakzāʾī (بارکزائی; Pashto: Bārakzay, بارکزی), a sub-tribe of the Durrānī, finally triggered an uprising led by his many sons in the course of which the central power collapsed almost completely. Several members of the ruling family were proclaimed as nominal rulers in both Peshawar (then the winter capital) as well as Kabul (the summer capital), while Maḥmūd Shāh and his successor, Kāmrān Shāh, managed to retain control over the province of Herat only (1818-1842). The various sons of Fatḥ Khān meanwhile usurped the remaining provinces (see Kandahar, Kabul, Peshawar), including those of the former and current capitals in the Pashtun heartlands, without however agreeing on any form of joint or central authority.
One of the sons of the late Fatḥ Khān, Sardār Dūst Muḥammad Khān gained control over the province of Kabul in 1826, and in 1834, partially in response to the loss of Peshawar and its districts to the Sikhs in the Panjab earlier that year, assumed the titles of Amīr (امیر) as well as Pādshāh (پادشاه). While the former title probably marked his leadership of the tribe, the latter (royal) title clearly marked a claim to the full sovereignty — even though he then only held control over a small share of the former Durrānī domains (as he himself professed in 1837) , namely the province of Kabul, with that of Kandahar being held by three of his brothers. Herat remained under the former dynasty still and Balkh and Badakhshan were largely autonomous under nominal Uzbek suzerainty.
The name Afghānistān (افغانستان), meaning 'Afghan-land' in Persian, and formed from a Persian exonym for the Pashtuns, originally meant only the predominantly Pashto-speaking territories around Kandahar on the one hand and Peshawar on the other, without any political connotations. During the early 19th century, the term came to be used to describe those parts of the former Durrānī state, in British colonial contexts previously also called the 'Empire of the Afghans', neither annexed by neighbouring powers nor as yet unified under any one ruler. As such it was used not only by the British colonial authorities in India, but also (at least in the official English translation) by Amīr Dūst Muḥammad Khān and his successors in diplomatic correspondence ("country of Affghanistan" as early as 1838). After a British attempt to restore the Sadūzāʾī clan of Aḥmad Shāh (1839-1842) ended in failure, the restored Amīr Dūst Muḥammad Khān successfully reintegrated both Balkh or Afghan/Lesser Turkistan (1849), Kandahar (1855) and Herat (1863), only for the country to yet again plunge into a civil war during the ensuing succession struggle among his sons after his death in 1863.
The first Afghan historian to mention 'Afghanistan' as a political entity was Sulṭān Muḥammad Bārakzāʾī, who began to write his Tārīkh-i Sulṭānī in 1865. Reflecting the altered political realities of the second half of the 19th century, the author identified Afghanistan as the territory located between Hindustan, Iran, and Turkistan, and subject to Russian, British, and Iranian imperial ambitions. 
Another British occupation of both Kandahar and Kabul in 1879 and the subsequent attempt to permanently divide the country into independent provinces failed as well, with both Kandahar and Herat being fully re-integrated with Kabul during 1881. One condition of British recognition of ʿAbd al-Raḥmān Khān as ruler of Afghanistan (1880) as well as financial and military assistance though was the subordination of Afghan foreign relations to the Government of British India, formally confirmed by treaty in 1905, which was observed until declared void by Afghanistan in April 1919, which in turn was (eventually) accepted by British India in August 1919.
The now fully independent status of the country was stressed both internally and externally in that the country was formally called Dawlat-i ʿalīyah-ʾi mustaqilah-ʾi Afghānistān (دولت عليهٔ مستقلهٔ افغانستان), the Sovereign High State of Afghanistan; the variant form, Mamālik-i maḥrūsah-i Afghānistān (ممالک محروسه افغانستان) can also be found used in international relations at the time — until the constitution of 1923 fixed the polity name to be Dawlat-i ʿalīyah-ʾi Afghānistān (دولت علیّهٔ افغانستان).
Nevertheless, a variant, Dawlat-i shāhī-i Afghānistān (دولت شاهى افغانستان), the Royal State of Afghanistan, and likely a translation of the diplomatically recognized form 'Kingdom of Afghanistan' can be found used in international treaties, though after 1945 it was eventually replaced by Dawlat-i pādshāhī-i Afghānistān (دولت پادشاهی افغانستان).
The constitution of 1964 defined the country as a dawlat-i pādshāhī (دولت پادشاهی), but it did not formally make it the polity name. Yet this form continued in both regular internal and external use (Afghanistan Official Gazette and bilateral international treaties, resp.).
In Pashto, which became co-official gradually and in 1964 formally became the primary official language, the form Loṛ dawlat da Afghānistān (لوړ دولت دافغانستان), or with modern grammar, Da Afghānistān loṛ dawlat, was superseded by Da Afghānistān pādshāhī dawlat (دافغانستان پادشاهی دولت), matching the Persian (now renamed Dari) forms.