Ali Ghaidan, Abbud Qanbar, the Police chief and the NCO's beneath them are the ones that made it happen by giving such instructions to their troops, instructions given by the top 3 commanders who are now held accountable.
What makes you think they will just start fleeing ones the enemy comes, this has not happened in the thousands of other clashes across Iraq since 2003 other then small groups of soldiers deserting because they did not want to fight, which makes sense considering many of Iraq's recruits are coming for payroll they're no soldier material, the bad short training doesn't get them to the right level, that also explains why many soldiers don't perform well and end up captured or dead.
They simply followed commands this time. Where does the problem lie ? the commanders especially the 2 highest Ali Ghaidan and Abbud Qanbar, everything lies in their hands. They are the ones who decide what training program the soldiers get, they are the ones who can forbid religious flags and slogans from soldiers. However they didn't do any of that to create a professional military, either they don't know it and aren't interested in the military field or they simply want to collect the paycheck.
Any soldier or group of soldiers that abandon their duty or post without permission is listed as desertion. In China they sentence such people to death, in Iraq the state is too unorganized to even find them after desertion. However this was no desertion.
Anyway what would you do in their position as a soldier with the lowest ranks which are the ranks of most soldiers, go against the command to leave the area ? together with 10-15 of other soldiers who might listen to you if you're lucky while everyone else is leaving following commands ?
Open this
Command_hierarchy and look at the table on the right.
In this case the Lieutenant General Ali Ghaidan abandoned the area himself, he gave the command and the other lower commanders followed it through which they should not have if they were given proper military officer education but they weren't. Now there have been some low ranking commanders who did it right against the suspicious orders from the high command however those soldiers were too few in numbers, 10-15-30 other soldiers let's assume, We saw some of them who did that, they stayed and fought but they were killed.
Those who took of their uniforms were groups of soldiers and NCO's who did not receive the command to pull out, they realized the majority retreated but it was way too late therefor they out of fear left the area trying to blend in as civillians.
Of course a lot of equipment was left behind as well, it was no tactical retreat after all but a messy and unorganized 1, if the instructions to pull out of the city were legit ( usually) no equipment would have been left behind ( tactical retreat ). However you can't have such a retreat except if there is betrayal by commanders which was the case here.