I am still amazed that after accomplishing the objectives of largely disrupting and destroying AQ in late 2001, at a cost of at most hundreds of millions of dollars, we continued on for another 11 years (and likely to be at least 13, and possibly more), accomplishing essentially nothing more. The CIA (led by Gary Schroen, who wrote about his mission in First In http://www.amazon.com/First-Insiders-Account-Spearheaded-Afg...) and 2 ODAs, combined with air power and some ground controllers, essentially accomplished all of the world's critical policy objectives before the end of 2001.
The primary security risk from Afghanistan is our presence there, exposing forces to attack. The secondary risk is corruption and terrorist groups funded directly or indirectly by us or enemies funding due to our presence there. There is essentially no external threat from Afghanistan, even to Pakistan, and there hasn't been since 2002.
I think in retrospect, one of the greatest faults with the Obama presidency was deciding to "double down" in Afghanistan in 2009, rather than an accelerated withdrawal. It's hard to believe Obama actually wanted to remain there, so it's primarily that he didn't feel strongly either way and relied on the advice of others, for either domestic-political or military reasons.
My absolute favorite work about the whole war in Afghanistan is First In (http://www.amazon.com/First-Insiders-Account-Spearheaded-Afg...) which is how the entire war should have been fought: A CIA man, a couple ODAs (~20 US Army Special Forces soldiers), an old ex-Soviet helicopter, and $30mm in $100 bills, and victory in 2 months. I sent a copy to weev in prison, will be interesting to see what he thinks :)