That's a great question.
I think that the issue of certainty is one that eludes us, when we are not dealing, really, with the aspect of training. I can be very certain about training an individual to be a good soldier and putting them in platoons, companies, squadrons and regiments and having them acquit themselves well.
If you are an armed forces that has been well trained yet you are still under government control or in a country that hasn't yet solved the societal schisms or the challenges within their country as it relates to how they are managing the country, then even the best military can't withstand that. To put it bluntly, there's really no point in having a great military inside a country that is not equally great.
The Iraqi military was overtaken by a number a things, not the least of which was that their country was failing.