Afghanistan holds the world record of changes to its national flag, reflecting the turbulent history of the country. A crossroads between East and West, it has seen many invaders and conquerors, while local rulers also invaded surrounding lands to form their own empires. Ahmad Khan (c. 1723-1773), born in Herat, initially served the Persian ruler Nader Shah, but after Nader's assassination Ahmad was proclaimed leader of his Abdali clan as Ahmad Shah Durrani in 1747. His Durrani Empire, centred around Kandahar, is considered the beginning of modern Afghanistan.
The Durrani Empire was a large state and included modern Pakistan, parts of the Punjab (India) and northeastern Iran. Its last ruler, Ayub Shah, was killed in 1823 but its flag, a green-white-green triband, remained in use in the Emirate of Herat (1818-1842). The Barakzai dynasty was established by Dost Mohammad Khan in 1826 but no official national flag was used until 1880: Emir Abdur Rahman united the country after the second Anglo-Aghan war of 1878-80 and adopted a flag in his dynastic colour, black. His son, Habibullah Khan, added in 1901 a white seal featuring a "mehrab", an arch in a mosque where the praying congregation stands, facing the Kaaba in Mecca; this emblem has featured on most Afghan flags since then. Abdur Rahman's grandson, Amanullah Khan modified the flag design in 1919, the year Afghanistan's Independence was recognised by the British after the third Anglo-Afghan war by adding rays emanating from the seal in the form of an octogram.
Amanullah became King (Shah) in 1926 and two years later, after a visit to Europe, Amanullah initiated a series of ambitious efforts at social and political modernisation of the country; there were three flag changes in 1928: the vertical black-green-red flag has proved most durable, but, as part of his radical reforms, the emblem on the middle stripe abolished the religious symbols and instead featured a design more suited to a socialist country. A year later an uprising in protest to the King's rapid modernization plans forced Amanullah's abdication. Tajik leader Habibullah Ghazi Kalakani became the next king of Afghanistan and adopted a red, black, and white tricolor, the same flag that was used when modern-day Afghanistan was under Mongol occupation in the 13th century. But only a few months later Habibullah was arrested and executed by troops of Amanullah's General Mohammad Nadir Khan, who declared himself King, or Shah, of Afghanistan on October 16, 1929. The black, red, and green tricolor was re-established; the octogram seal from the first flag of Amanullah Shah replaced the sun and mountains seal and the following year the design was changed to the one that would remain in use until 1973: a "mehrab", flanked by two flags and ensconced in two sheaves of wheat, with underneath it the date 1348 in the Muslim calendar (equivalent to 1929), the year Nadir's dynasty acceded to the throne.
On 17 July 1973, when King Muhammad Zahir Shah was abroad, a coup d' état, directed by the King's brother-in-law and ex-Prime Minister Mohammad Daud Khan took place and a Republic was proclaimed. The date 1348 on the flag's emblem was removed by decree; a plain flag, without the coat of arms, was also used. The following year a new republican flag was adopted: the same colours were used, but now a horizontal tricolour with a republican emblem at the upper hoist: an eagle with a "mender" (a many tiered pulpit placed to the right of the mehrab in a mosque, from which addresses are delivered). Then on 27 April 1978 a Marxist coup took place by military officers, who handed over power to Nur Muhammad Taraki's communist People's Democratic Party three days later. The republican emblem was removed from the flag and on 19 October that year a red flag with the party emblem in gold was introduced, provoking much opposition from traditional Muslims who could not accept an atheist communist regime. Then, in September 1979, the radical Prime Minister Hafizullah Amin staged a coup in which Party Chief Taraki was killed. Amin became president and adopted the Party flag as a National flag. A few months later Soviet troops invaded and occupied the country, handing power from the "Khalq" to the "Parcham" faction, led by Babrak Karmal, on 27 December 1979; President Amin was killed, probably executed. In an attempt to placate the traditionalists, the flag was changed in 21 April 1980 to a more Islamic design while keeping certain communist symbols on a black-red-green field; however, various "Mujahedeen" resistance groups fought the communist regime and its Soviet backers. In 1986 Soviet troops were gradually withdrawn and the following year, in 30 November 1987, General Mohammed Najibullah, who had succeeded Karmal, was appointed President. A new constitution was adopted, making concessions to moderate islamists; the communist emblems disappeared from the flag.
Meanwhile however, various mujahedeen had fought under banners in which the Islamic colours white and green were dominant. In February 1989 the Islamic State of Afghanistan was proclaimed in Peshawar (Pakistan) by the seven Sunni opposition groups. A black-white-green flag with an Islamic emblem and inscriptions affirming the Muslim faith was adopted. After the Soviet withdrawal there was a power struggle between Mujahedeen factions but on 28 April 1992 the Islamic State of Afghanistan was proclaimed. The new government soon splintered into rival factions and during 1992 various unofficial flags with black, white and green stripes with Islamic inscriptions on the stripes were used. On 2 December 1992 a flag based on that of the exile government became official. Meanwhile, a movement known as "Taliban" arose around Kandahar in the south and gradually took over the country capturing Kabul in late 1996 and changing the country's name to Islamic Emirate of Afghanistan. The flag was plain white; the following year on 27 October 1997, the "Shahada" (Muslim declaration of Faith) was added in black. The fundamentalist Taliban regime was not recognised internationally and collapsed after American bombardments following the terrorist destruction of New York's World Trade Center at the end of 2001. A provisional government was formed with interim leader Hamid Karzai. The new National Flag was based on the flag of 1930-1973 with the addition of the "Shahada" above the mehrab and the year 1298 in the Islamic calendar, equivalent of 1919 CE, the year of independence from Great Britain. Following an election in October 2004, Hamid Karzai won and became the President of the Islamic Republic of Afghanistan. The flag was changed slightly to a ratio of 2:3; on the scroll "Islamic State of Afghanistan" was replaced with simply "Afghanistan", as in 1930.