A complex tunnel system that exposes both the ingenuity and unremitting brutality of ISIL has been discovered by Kurdish forces after they drove the terrorist group out of a town in north-western Iraq.

Around 40 underground passageways running for hundreds of metres were found below Sinjar in the wake of its liberation this month, revealing munitions stockpiles, living quarters and mass graves.

"Daesh dug these trenches in order to hide from air strikes and have free movement underground as well as to store weapons and explosives," Peshmerger commander Shamo Eado told AP.

"This was their military arsenal."

Recalling the Cu-Chi tunnels of southern Vietnam, ISIL would retreat into the underground network, which contained American-made explosive ordnance, sleeping cots, weapons and kitchens, to avoid annihilation by US airstrikes.

But there was another purpose, even darker than ISIL's notoriously gruesome style of warfare – as a prison and final resting place for Yazidi sex slaves .

Two mass grave-sites have so far yielded the bodies of men, women and children.

In all, the subterranean hell is the grim resting place of some 120 souls – and the number is likely to rise; Mr Eado says he expects more tunnels will be discovered.