They occupied the country and mostly/almost did accomplish that. 2002 to ~2005 were reasonably clam.
Then their failures to bulld a stable government brought the Taliban back.
Then their failures to bulld a stable government brought the Taliban back.
US never closed the border with Pakistani - and the talibans retreated in Paki when under attack and then went back in Afghanistan when things calmed down.
In Afghanistan US won as much as it won in Vietnam.