If you're having trouble pinning down exactly what exactly our involvement in Afghanistan is all about (and anyone who isn't is lying to himself), you could do worse than reading P.J. O'Rourke's turn as the 72-hour expert:
Afghans think Americans have sided with the wrong people. It’s not that Afghans think Americans have sided with the wrong people in a systematic, strategic, or calculated way. It’s just that we came to a place that we didn’t know much about, where there are a lot of sides to be on, and we started siding with this side and that side and the other side. We were bound to wind up on the wrong side sometimes.
This parallels my own experiences in Iraq, where our leaders were very much focused on determining which factions in the government, tribes, and security forces were "good guys" and which were "bad guys", when most of the time it was really just "these guys" and "those guys". At the same time, our leaders genuinely didn't think of this good-guy/bad-guy categorization process as "picking sides" while the locals most certainly did. Whichever faction in a given area first figured out the rules of the game and presented themselves to the local US forces as the "good guys" thus won the support of the world superpower, who nonetheless maintained delusions of impartiality. Has it been mentioned recently that counterinsurgency is really really difficult? Sure, and foreign societies are awfully tricky to understand even when you're not dodging bullets. On the other hand, sometimes I get the impression that we really weren't trying that hard.