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 U.S. military presence in Iraq is not going away even as its combat mission officially ends on Dec. 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 kilometers (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 centers around the zone to better police the gaps.
"IS 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 Dec. 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 terrorize the residents, because we can't see them,'' Jawhar said.
The talks to re-establish joint coordination centers 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 centers 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.
So far, the PMF has been surprisingly quiet about the new joint arrangement, as it copes with a devastating loss in federal elections earlier this year.
But "at some point they will speak out against it,'' Zmkan Ali, a senior researcher at the Institute of Regional and International Studies, a research center in Sulaymaniyah.
The road to better coordination has often involved a common friend: The U.S.
Iraqi and Kurdish officials said the U.S.-led coalition's mediation and support were key in bringing parties to the table.
"They played an important role, coordinating with us and the Iraqi side,'' said Jawhar, the peshmerga based in Qarachok. "Without them we wouldn't speak, they wouldn't come here, and we wouldn't go there.''
Both sides say they still need the Americans to play that role.
U.S. troops quietly stopped direct involvement in combat against IS months ago and have since been advising and training troops. That role will continue when the combat mission formally ends on Dec. 31.
The U.S. presence is also crucial in other ways. The Americans pay the salaries of many peshmerga fighters, amid ongoing budget disputes with Baghdad. Some $240 million in U.S. funding covers the salaries of around 45,000 peshmerga personnel, according to Ismail.
"Thankfully, this will continue in 2022,'' he said.