To be fair, fighting an unconventional war against a guerrilla /rag tag army is different from fighting a convention war with a country's regular army. Arm groups /militias/rebels/terror groups don't fight like a conventional army. It's for this reason that the U. S/U. K/West could invade Iraq(who had one of the most powerful battle tested military in the middle east) and topple saddam in a couple of weeks but they still struggled to eliminate all the terrorists and militias groups that rose up following saddam fall. Same with Afghanistan and the taliban.
They don't fight like a regular army, more like hit and run, launch surprise attacks and withdraw immediately, lay ambushes, use IEDs etc etc. It's more difficult to fight such rag tag militias /rebels etc.