why did the United States chose to go to war in afghanistan?

The United States chose to go to war in Afghanistan in response to the terrorist attacks of September 11, 2001. The attacks were carried out by the militant group Al-Qaeda, which was operating out of Afghanistan under the protection of the Taliban regime. The US government believed that by removing the Taliban from power and dismantling Al-Qaeda's infrastructure in Afghanistan, they would be able to prevent future terrorist attacks against the United States and its allies. Additionally, the US government sought to promote democracy and stability in Afghanistan and prevent it from becoming a safe haven for terrorist organizations in the future.