During the nineteenth century, following the Anglo-Afghan wars (fought 1839–42, 1878–80, and lastly in 1919) and the ascension of the Barakzai dynasty, Afghanistan saw much of its territory and autonomy ceded to the United Kingdom. The UK exercised a great deal of influence, and it was not until King Amanullah Khan acceded to the throne in 1919 that Afghanistan re-gained complete independence over its foreign affairs (see "The Great Game"). During the period of British intervention in Afghanistan, ethnic Pashtun territories were divided by the Durand Line. This would lead to strained relations between Afghanistan and British India – and later the new state of Pakistan – over what came to be known as the Pashtunistan debate. The longest period of stability in Afghanistan was between 1933 and 1973, when the country was under the rule of King Zahir Shah.
However, in 1973 Zahir Shah's brother-in-law, Sardar Daoud Khan, launched a bloodless coup. Daoud Khan and his entire family were murdered in 1978, when the communist People's Democratic Party of Afghanistan launched a coup known as the Great Saur Revolution and took over the government.
As part of a Cold War strategy, in 1979 the United States government (under President Jimmy Carter and National Security Advisor Zbigniew Brzezinski) began to covertly fund and train anti-government Mujahideen forces through the Pakistani secret service known as Inter Services Intelligence (ISI). In order to bolster the local Communist forces, the Soviet Union—citing the 1978 Treaty of Friendship, Cooperation and Good Neighborliness that had been signed between the two countries—intervened on December 24, 1979. Over 100,000 Soviet troops took part in the invasion, who were backed by another 100,000 and plus pro-communist forces of Afghanistan. The Soviet occupation resulted in the killings of at least 600,000 to 2 million Afghan civilians. Over 5 million Afghans fled their country to Pakistan, Iran and other parts of the world. Faced with mounting international pressure and great number of casualties on both sides, the Soviets withdrew in 1989.
The Soviet withdrawal from the Democratic Republic of Afghanistan was seen as an ideological victory in the US, which had backed the Mujahideen through three US presidential administrations in order to counter Soviet influence in the vicinity of the oil-rich Persian Gulf.
Following the removal of the Soviet forces, the US and its allies lost interest in Afghanistan and did little to help rebuild the war-ravaged country or influence events there. The USSR continued to support President Najibullah (former head of the Afghan secret service, KHAD) until 1992 when new Russian government refused to sell oil products to Najibullah regime.
The result of the fighting was that the vast majority of the elites and intellectuals had escaped to take refuge abroad, a dangerous leadership vacuum thereby coming into existence. Fighting continued among the victorious Mujahideen factions, eventually giving rise to a state of warlordism. The most serious fighting during this period occurred in 1994, when over 10,000 people were killed in Kabul alone. The chaos and corruption that dominated post-Soviet Afghanistan in turn spawned the rise of the Taliban. The Taliban developed as a politico-religious force, and eventually seized Kabul in 1996. By the end of 2000 the Taliban were able to capture 95% of the country, aside from the opposition (Afghan Northern Alliance) strongholds primarily found in the northeast corner of Badakhshan Province. The Taliban sought to impose a very strict interpretation of Islamic law.
During the Taliban's seven-year rule, much of the population experienced restrictions on their freedom and violations of their human rights. Women were banned from jobs, girls forbidden to attend schools or universities. Those who resisted were punished instantly. Communists were systematically eradicated and thieves were punished by amputating one of their hands or feet. Meanwhile, the Taliban managed to nearly eradicate the majority of the opium production by 2001.
Following the September 11, 2001 attacks the United States launched Operation Enduring Freedom, a military campaign to destroy the al-Qaeda terrorist training camps inside Afghanistan. The US military also threatened to overthrow the Taliban government for refusing to hand over Osama bin Laden and his al-Qaida followers. The US made a common cause with the former Afghan Mujahideen to achieve its ends. In December of the same year, leaders of the former Afghan Mujahideen groups and diaspora met in Germany, and agreed on a plan for the formulation of a new democratic government that resulted in the inauguration of Hamid Karzai, an ethnic Pashtun from the southern city of Kandahar, as Chairman of the Afghan Interim Authority.
After a nationwide Loya Jirga in 2002 Karzai was chosen by the representatives to assume the title as Interim President of Afghanistan. In 2003, the country convened a Constitutional Loya Jirga (Council of Elders) and a new constitution was ratified in January 2004. Following an election in October 2004, Hamid Karzai won and became the President of the Islamic Republic of Afghanistan. Legislative elections were held in September 2005. The National Assembly – the first freely elected legislature in Afghanistan since 1973 – sat in December 2005, and was noteworthy for the inclusion of women as voters, candidates, and elected members.
As the country continues to rebuild and recover, it is still struggling against poverty, poor infrastructure, large concentration of land mines and other unexploded ordnance on earth, as well as a huge illegal poppy cultivation and opium trade. Afghanistan also remains subject to occasionally violent political jockeying. The country continues to grapple with the Taliban insurgency, the threat of attacks from a few remaining al Qaeda, and instability, particularly in the north, caused by the remaining few semi-independent warlords.
At the start of 2007 reports of the Taliban's increasing presence in Afghanistan led the US to consider longer tours of duty and even an increase in troop numbers. According to a report filed by Robert Burns of Associated Press on January 16, 2007, "U.S. military officials cited new evidence that the Pakistani military, which has long-standing ties to the Taliban movement, has turned a blind eye to the incursions." Also, "The number of insurgent attacks is up 300 percent since September, 2006, when the Pakistani government put into effect a peace arrangement with tribal leaders in the north Waziristan area, along Afghanistan's eastern border, a U.S. military intelligence officer told reporters."