<Li> Insurgents' bodies </Li> <Li> U.S.--Afghan Strategic Agreement </Li> <P> The War in Afghanistan (or the U.S. War in Afghanistan; code named Operation Enduring Freedom--Afghanistan (2001--2014) and Operation Freedom's Sentinel (2015--present)) followed the United States invasion of Afghanistan of October 7, 2001 . The U.S. was supported initially by the United Kingdom and Canada and later by a coalition of over 40 countries, including all NATO members . The war's public aims were to dismantle al - Qaeda and to deny it a safe base of operations in Afghanistan by removing the Taliban from power . The War in Afghanistan is the second longest war in United States history, behind the Vietnam War . </P> <P> Following the September 11 attacks in 2001 on the U.S., which President George W. Bush blamed on Osama bin Laden who was living or hiding in Afghanistan, President Bush demanded that the Taliban hand over Osama bin Laden and expel al - Qaeda; bin Laden had already been wanted by the U.S. since 1998 . The Taliban declined to extradite him unless they were provided evidence of his involvement in the September 11 attacks and also declined demands to extradite others on the same grounds . The U.S. dismissed the request for evidence as a delaying tactic, and on October 7, 2001 launched Operation Enduring Freedom with the United Kingdom . The two were later joined by other forces, including the Northern Alliance which had been fighting the Taliban in the ongoing civil war since 1996 . In December 2001, the United Nations Security Council established the International Security Assistance Force (ISAF), to assist the Afghan interim authorities with securing Kabul . At the Bonn Conference the same month, Hamid Karzai was selected to head the Afghan Interim Administration, which after a 2002 loya jirga (grand assembly) in Kabul became the Afghan Transitional Administration . In the popular elections of 2004, Karzai was elected president of the country, now named the Islamic Republic of Afghanistan . </P>

When did us go to war in afghanistan