The Taliban government of Afghanistan provided sanctuary and material support to al Qaeda while it was planning the 9/11 attacks on the United States and then, after the attacks, refused to withdraw that sanctuary or surrender Osama bin Laden to the United States, flippantly suggesting that the United States should consider the possibility that Israel was responsible for the attacks instead.  Those were grounds for war.  After it was clear that the United States was going to war, beginning with bombing,   the Taliban changed its tune slightly, saying it would try Osama bin Laden in Afghanistan in an Islamic court or hand him over to a neutral country.