As a backhoe dug up the ground to build trenches, Iraqi soldiers scanned the vast farming tracts for militants; not far away, their Kurdish counterparts did the same.
The scene earlier this month in the small northern Iraqi farming village of Lheiban was a rare instance of coordination between the federal government and the semi-autonomous Kurdish region. The two sides were fortifying a joint position aimed at defending the village against attacks by the Islamic State group.
Despite a long-standing territorial dispute, Baghdad and Iraq's Kurds are taking steps to work together to prevent a resurgence of the Islamic State group.
Whether the fragile security partnership can hold is the big test in the next chapter of Iraq's war with IS. Both sides say they need the Americans to help keep it together — and they say that is one reason why the US military presence in Iraq is not going away even as its combat mission officially ends on December 31.
Iraq declared IS defeated four years ago this month. But the rivalry between Baghdad and the Kurds opened up cracks through which IS crept back: a long, disputed zone snaking through four provinces -- Nineveh, Kirkuk, Salaheddin and Diyala -- where the forces of either side did not enter. In some places, the zone was up to 40 km (24 miles) wide.
Lheiban lies in one part of the zone, and a recent flurry of IS attacks threatened to empty the area of its residents, mostly Kurds.
So, for the first time since 2014, Iraqi troops and peshmerga are setting up joint coordination centres around the zone to better police the gaps.
“Daesh took advantage,” said Capt. Nakib Hajar, head of Kurdish peshmerga operations in the area, using the Arabic acronym for IS. Now, he said, “we are coordinating ... It begins here, in this village.”
Like all residents of Lheiban, Helmet Zahir is tired. In past months, the cement factory worker would spend all night on the roof of his humble home, his wife and children sleeping inside, holding his rifle and waiting.
Security personnel guarding a nearby oil company – the only ones in the area equipped with thermal night vision – would send the signal when they spotted IS militants making their way down the Qarachok Mountain range toward Lheiban.
It was up to Zahir and other armed residents to fend them off.
“We were abandoned. The peshmerga was on one side, the Iraqi army on another and neither was intervening,” he said.
A recent uptick in attacks on the village, with three in the first week of December alone, prompted many of the village's residents, who are mainly Kurds, to leave. Zahir moved his family to Debaga in the relative safety of the Kurdish-run north.
Once numbering 65 families, Lheiban now has only 12 left, said village mukhtar Yadgar Karim.
On December 7, peshmerga and Iraqi forces moved into the village with plans to replicate coordination elsewhere across the disputed territories. Kurdish officials hoped this would prompt villagers to return. Maintaining a Kurdish population in the area is key to their territorial claims.
Zahir is not convinced. “I came to check on the situation only, I am too afraid to return,” he said.
The peshmerga have positions all along the ridge of the Qarachok mountains. But they don't have orders to stop IS militants as they cross on attacks or to raid IS positions because of wariness over entering disputed territory, explained Col. Kahar Jawhar.
Moreover, the militants move at night, using tunnels and hiding in caves, and the peshmerga lack key equipment including night vision.
“That is why IS are able to terrorise the residents, because we can't see them,” Jawhar said.
The talks to re-establish joint coordination centres between the Iraqi army and peshmerga began over two years ago, but fell apart because of deep mistrust and differences over how to carve out lines of control.
Under current Prime Minister Mustafa al-Kadhimi, talks were rekindled, paving the way for an agreement to set up six joint coordination centres in Baghdad, Irbil, and across the disputed zone.
Kadhimi also agreed to establish two joint brigades to conduct anti-IS operations. But this is awaiting budget approval from Baghdad's Finance Ministry, said Hajar Ismail, peshmerga head of relations with the coalition.
Between 2009-2014, Iraqi and Kurdish forces conducted joint security in the northern provinces of Ninevah, Kirkuk and Diyala. But the collapse of the Iraqi army during the IS onslaught of 2014 ended the arrangement.
Kurdish authorities managed to solidify control over Kirkuk and other disputed areas during this time, even developing oil fields and conducting an independent export policy, to the ire of the federal government.
After Iraq declared victory over IS in 2017, Baghdad turned its sights to these areas, launching a military operation in October 2017 to retake them. Relations soured, with Baghdad cutting off budget allocations to the Kurdish region, rendering it unable to pay public sector workers and debts to oil companies.
Baghdad was long reluctant to resume security talks partly due to political optics in the capital, with many dominant Shiite parties deeply mistrustful of Kurdish intentions, according to federal officials.
The Popular Mobilization Forces, made up largely of Shiite militia groups close to Iran, has opposed joint patrols with the peshmerga. The PMF also has a powerful presence in many areas in the disputed zone.