I don’t think we ever defined the enemy in Afghanistan. However, Russia, China and Iran are our enemy, and having a large base there, makes us more capable with dealing with such threats.
Bush did when he went in: The Terrorist training camps and the "State" that supported them.
Both were eliminated within the first few months and that's when we should have got out.
Back for occasional killing sprees, of course.