Afghanistan's history as a country spans little more than two centuries, although it has contributed to the greatness of many great Central Asian empires. As with much of the region, the rise and fall of political power has been inextricably tied to the rise and fall of religions.
It was in Afghanistan that the ancient religion of Zoroastrianism began in the 6th century BCE. Later, Buddhism spread west from India to the Bamiyan Valley, where it remained strong until the 10th century AD. The eastward sweep of Islam reached Afghanistan in the 7th century AD, and today the vast majority of Afghanis are Muslim.
Between 1220 and 1223, Genghis Khan tore through the country, reducing Balkh, Herat, Ghazni and Bamiyan to rubble. After damage was repaired, Timur swept through in the early 1380s and reduced the region to rubble again. Timur's reign ushered in the golden Timurid era, when poetry, architecture and miniature painting reached their zenith.
Timur's fourth son, Shah Rukh, built shrines, mosques and medressas throughout Khorasan, from Mashad, in modern-day Iran, to Balkh. Herat continued to prosper under Sultan Hussain Baykara (died 1506), producing such great Central Asian poets as Jami and Alisher Navoi.
The rise of the Great Mogul empire again lifted Afghanistan to heights of power. Babur had his capital in Kabul in 1512, but as the Moguls extended their power into India, Afghanistan went from being the centre of the empire to merely a peripheral part of it. In 1774, with European forces eroding the influence declining Moguls on the Indian subcontinent, the kingdom of Afghanistan was founded.
The 19th century was a period of often comic-book confrontation with the British, who were afraid of the effects of unruly neighbours on their great Indian colony. The rise of tensions and the weakness of the Afghan kingdom resulted in some remarkably unsuccessful and bloody wars being fought on extremely flimsy pretexts. The first, between 1839 and 1842, saw the British garrison almost totally wiped out while retreating in the Khyber pass - out of 16,000 persons, only one man survived. The British managed to re-occupy Kabul and carried out a bit of razing and burning to show who was boss, but this again was short-lived.
Following local wars, from 1878 to 1880, Afghanistan agreed to become more or less a protectorate of the British, happily accepted an annual payment to keep things in shape and agreed to a British resident in Kabul. No sooner had the diplomatic mission been installed in Kabul, however, than all its members were murdered. This time the British decided to keep control over Afghanistan's external affairs, but to leave the internal matters strictly to the Afghans themselves.
In 1893 the British drew Afghanistan's eastern boundaries along the so-called Durand Line, neatly partitioning many Pathan tribes into what today is Pakistan. This has been a cause of Afghan-Pakistani strife for many years, and is the reason the Afghans refer to the western part of Pakistan as Pashtunistan.