Do not commit the error, common among the young, of assuming that if you cannot save the whole of mankind you have failed.
Afghanistan is a country in need. Afghanistan needs to protect itself in the region; Afghanistan needs to secure itself within the country. Afghanistan needs to develop its forces, and Afghanistan needs to provide stability to the people.
I believe the most compelling explanation of Obama's actions is that he is, just like his father, an anti-colonialist.