TBH it is a bit of a stretch to turn this into a moral fight between religiously motivated zealots vs defenders of "liberal" values. For a start, the last two Iraqi regimes have been about as far away from being secular, liberal, defenders of sexual choice etc etc as anywhere else in the middle east is.
IS is appearing* to win because it is better trained, better paid, better equipped, has better intelligence, a better supply network, allies with deeper pockets and is less corrupt than the Iraqi state forces have been. Of course this is one of the consequences of sacking most of the pre-2003 Iraqi Army, then training its replacement on the cheap, then making sure it couldnt do what Saddam's did (ie: scare the Saudis), and finally letting it (and the country) be led by some of the worlds very best proponents of graft.
* appearing in the sense that all of its victories are proclaimed by everyone, especially the Western media, whilst its failures recieve less attention. What the real situation on the ground is, is anyones guess though one would imagine that the longer this goes on the Iraqi Army will get (through a process of Darwinianism) progressively less bad.