The father of modern sociology, Max Weber, pointed out that governments draw their legitimacy from three basic sources: traditional, religious, and legal. The first two are self-explanatory; by "legal," Weber meant Western-style democracies based on popular representation and the rule of law. And in this sense, political failure in Afghanistan was baked into the cake in the 2001 Bonn Process.
In its rush to stand up an overnight democratic success story, the Bush administration overlooked Afghan history. Indeed, it was willfully ahistorical. That's tragic, because Afghan history demonstrates conclusively and beyond dispute that legitimacy of governance there is derived exclusively from Weber's first two sources: traditional (in the form of the monarchy and tribal patriarchies) and religious. Either there has been a king, or religious leadership, or a leader validated by the caliphate (or afterwards by indigenous religious polities).
Often in Afghan history, legitimacy thus derived has been reinforced by other means, usually coercive and often brutal. For example, the rule of Amir Abdur Rahman, "The Iron Amir," (1880-1901) and that of the Taliban (1996-2001) were predicated on accepted sources of legitimacy of governance (dynastic and religious, respectively), but reinforced by totalitarian methods. These two examples make the point that legitimacy should not be conflated with popularity: having the authority to rule is quite distinct from being a popular ruler. American presidents, for example, are always legitimate leaders but not always popular ones.