The Kurds, a different ethnic group from Iraq's majority Arabs, have their own armed fighters and enjoy considerable control over an increasingly prosperous enclave in Iraq's mountainous north. Thursday's accord calls for the eventual withdrawal of Iraqi military and Kurdish fighters who in recent weeks moved into disputed areas where both seek to extend their influence.
There is no timetable governing the pullout of troops, tanks and artillery on either side, meaning tensions could quickly flare back up. Distrust remains high, and the two sides are far from reaching a lasting deal over how to manage energy resources and divvy up the growing profits oil brings in.
"This is only the symptom," Martin Kobler, the U.N. envoy to Iraq, said of the military standoff in an interview this week. "We have to go to the root. And the root is the Arab-Kurdish understanding. … Distribution of wealth in this country is distribution of power, period."
The dispute that has played out over the past month shows just how unstable Iraq remains nearly a decade after the U.S.-led invasion, and injects an added level of uncertainty into a Middle East grappling with the potential collapse of Syria, on Iraq's doorstep.
A shootout between Iraqi police and Kurdish guards in the disputed northern city of Tuz Khormato kicked off the most recent bout of brinksmanship in mid-November. One civilian was killed and several police officers were wounded in the gun battle, the first deadly clash between the two sides in years.
Both sides responded by moving additional troops into the disputed areas. The buildup happened after Iraqi Prime Minister Nouri al-Maliki created a new military command overseeing security forces in contested areas bordering the Kurdish region. Kurds saw that as a provocation.
Tensions spiked earlier this week when the president of the Kurdish region appeared on television inspecting his green camouflage-clad troops near Kirkuk, an oil-rich city outside the Kurds' autonomous enclave that has long been seen as a likely flashpoint for ethnic conflict. Massoud Barzani was shown alongside one of his sons, who was outfitted in full combat gear.
Iraqi Arabs bristled at the symbolism of the visit, which drew barbed comparisons to ousted dictator Saddam Hussein. Yassin Majid, an Iraqi lawmaker allied with al-Maliki, was among the most vocal.
"Barzani's visit to Kirkuk was meant to send a message of war to all Iraqis. … This reminds us of Saddam when he used to take his sons while visiting military units on the front lines," Majid said. "Barzani is acting like the president of a neighboring country to Iraq and … he is pushing things toward war."
Despite the bluster, both sides benefit from not allowing the standoff to spiral into a shooting war.
Full-blown fighting would spook the foreign investors who have flocked to the Kurds' self-rule region. It would also set back the central government's efforts to restore stability and security after years of violence.
Those realizations may have helped push Barzani and al-Maliki to agree to Thursday's deal, which calls on both sides to halt all media campaigns that could lead to more tension and work toward eventually withdrawing their military forces from disputed areas.
Under the plan, committees will be set up to create security forces made up of local inhabitants — a process that could prove tricky because it will have to balance competing ethnic and sectarian claims.
Iraqi President Jalal Talabani, himself a Kurd, helped negotiate the accord.
Ali al-Moussawi, a spokesman for al-Maliki, said he is optimistic but noted that the "real test will be the actual withdrawal of the deployed forces." The Kurds likewise remain cautious about the issue of security forces for the disputed areas.
"This issue is sensitive and it needs work on the tiniest details so that any agreement, if reached, would guarantee that what has happened recently would not be repeated," the Kurdistan Regional Government said in a statement.
The remaining risks are real. Iraqi and Kurdish officials, as well as foreign diplomats, fear that a miscalculation by a single soldier on either side might spark a firefight that could escalate.
The American military kept tensions between the two sides in check over much of the past decade. But the last American troops left on Dec. 18, 2011 — except for a small number of personnel attached to the U.S. Embassy that are responsible for facilitating Iraqi arms purchases and training Iraqis to use the weapons.
"After 2011, Iraqi politics are operating under their own logic again," said Toby Dodge, an analyst at the International Institute for Strategic Studies think tank in London. "Al-Maliki's consolidating and expanding (power). The Kurds are the last autonomous force that stands in his way."
American military commanders were aware of the risks of Arab-Kurd friction, which they described as one of the biggest threats to Iraq's security in the years before the U.S. pullout. Concerns about ethnic violence prompted the U.S. to create checkpoints jointly run by American, Iraqi and Kurdish forces in the disputed areas, effectively forcing the two sides to work together.
In recent weeks, American officials have pressed the Iraqi government and the Kurds to stop their troop movements and provocative statements while working toward some type of agreement.
Troops from both sides faced off near the Syrian border over the summer too, but American observers viewed the latest standoff as more worrying.
"There's an intensity here that wasn't present back in July on the Syrian border," said a U.S. Embassy official, who was not authorized to speak publicly about the matter so insisted on anonymity. "It's an on-the-ground form of negotiation that's really risky."