My understanding was that we went into Afghanistan because that's where Osama bin Laden was at the time.
Perhaps we should have dealt with Saudi Arabia instead? That's where Osama was from, along with a number of the others who were part of the 9/11 attacks.