KHURBADAN, IRAQ - The Iraqi troops fought long and hard to drive Islamic State (IS) fighters from this village 60km from the group's stronghold of Mosul. Even with US coalition air support, the battle was arduous and costly, and when it was over the troops found out why.

Around Khurbadan, a settlement of only a few thousand people, ran kilometres of minefields protecting trenches, which were themselves linked by machine-gun nests, sniper positions and mortar pits.

In many areas, IS had burrowed deep into the earth to create a network of tunnels that were booby trapped by fleeing fighters - tunnels Iraqi soldiers now have to clear.

In an exclusive tour, Middle East Eye saw dozens of rooms carved out of the sandy rock to depths of nine metres, hospital quarters with medical supplies, sleeping areas full of mattresses and pillows and prayer rooms stocked with Qurans.

"This is trench warfare," said Firas al-Naser, a commander in the Iraqi army, likening the recent battle to the attrition of the First World War.

"The fighters hide like rats, and the tunnel network becomes a city within a city. There is everything: weapons, beds, prayer rooms, rooms to prepare explosive devices."

Many areas were still too dangerous to enter more than a month after Khurbadan was liberated, and improvised explosive devices and booby traps were an ever-present danger.

An IS booby trap in Khurbadan (MEE/Francesca Mannocchi)

In some chambers, medical supplies were strewn across the floor, suggesting injuries being treated during a hasty retreat by the IS. Everyday objects such as knives, forks and plates were left behind, as were a multitude of weapons.

Sandbags lined walls, wire mesh reinforced ceilings, and rudimentary wiring delivered electricity.

"Entire areas of the network were used as depots. This is where they kept hidden explosives,” said Naser. "They hid here from the bombs, and the tunnels became escape routes in case of danger."

Many of the tunnels appeared to have been hewn with jackhammers. Some are barely high enough to stand, others could only be accessed by crawling.

Such small spaces instantly closed in on those who ventured down - stifling heat and lack of air heightened the sense of claustrophobia and imminent peril.

According to Naser, IS pressed villagers into the the dangerous job of digging.

"Many civilians who fled tell us they were forced to dig, and that some died doing so," he said.

The entrance to an IS tunnel in Khurbadan (MEE/Francesca Mannocchi)

Such complex networks have not been discovered since IS was kicked out of the Yazidi city of Sinjar, where more than 70 tunnels were found.

"One of the problems is that these tunnels - just like in Sinjar - have undermined the soil and often destroyed part of the infrastructure of the cities and villages," Naser said.

Destroying the tunnels and making structures above ground safe again will be dangerous work. Troops must move room to room, passageway to passageway, looking for traps left by fleeing fighters, while ensuring against cave-ins.

Slog to Mosul

The battle for Khurbadan was part of Iraq’s attempt to evict IS from the north of the country. A three-pronged attack was mounted in March to retake Mosul, after many stalled attempts.

Iraqi army soldiers are moving from the south, while Kurdish peshmerga forces are pushing from the north and east.

There are scores of settlements like Khurbadan between here and the ultimate prize.

The village itself still carries scars of a vicious battle. Cars sit wrecked in the streets, bodies lay where they fell in fierce fighting.

Inside a mosque, near where one of the tunnels begins, the corpse of an IS suicide bomber has not yet been removed, for fear it is still booby trapped.

"We killed several snipers and suicide bombers before they exploded," says Naser. "We burned a truck ready to explode, fortunately in time so it did not kill more innocents. There are still bodies of IS militiamen in some buildings."

A vehicle that was rigged with explosives by IS in Khurbadan (MEE/Francesca Mannocchi)

Meanwhile, IS continues to harass Iraqi forces in the areas they have taken, mounting raids and lobbing mortars and rockets at troops.

Minefields left behind by militants are also a constant danger, and they are not being cleared as quickly as many would like.

Boarding his Iraqi army Humvee, a driver said that roads around Khurbadan were still extremely dangerous. Hours earlier, a mine had destroyed a similar vehicle.

Still 60km from Mosul, the Iraqi army is facing stiff resistance from an entrenched and devious enemy.

"The liberation of this village has caused many human losses," Naser said. "IS still has about 10,000 militiamen in Mosul. This means that our offensive will be long and probably very expensive."

The slow slog to Iraq's second city, it seems, will not speed up any time soon.