The Kurdish peshmerga fighter ran out of ammunition but saved two bullets to end his own life in case Islamic State militants caught up with him as he fled the front line in northwest Iraq.

After a two-month standoff along a 1,000-km-long front, the Kurds failed their first major test, allowing the Sunni militants who want to redraw the map of the Middle East to grab more towns, oil fields and Iraq's biggest dam.

The peshmerga, literally "those who confront death," had built up a reputation as fearsome warriors, but in the end they proved no match for the better-armed militants who attacked them with suicidal zeal.