The problem with Libya and Iraq (as well as Afghanistan!) is that there never has been a coherent post-war plan. Which means: what is to be done after the troops are finished?
There has been no plan about
- how to disarm the various militias enlisted to fight
- how to transition countries to democracy without kleptocrats and other opportunists abusing and hijacking the system
- how to actually rebuild all the destroyed infrastructure (roads, bridges, water, electricity, communication)
- how to actually unite and pacify the various ethnic/religious communities and prevent them from fighting each other: this is what fucked up former Yugoslavia, and now Libya, Iraq and Afghanistan, and will likely drag out the Syria conflict.