When ExxonMobil, the world's largest international oil company, signed a deal for oil rights with the Kurdish regional government (KRG) last November, the simmering tensions between Erbil and Baghdad were again exposed.
Until the American major entered the scene, the struggle over the control of the region's natural resources had ceased to attract much interest from outside observers. It was Iraq's potential to become the next oil-producing superpower that was given most of the attention.
Exxon, however, was soon followed into Iraqi Kurdistan by France's Total and Chevron of the United States. An angry Baghdad threatened to expel the oil majors from elsewhere in Iraq, and refused to send oil payments to the KRG, which responded by stopping all its exports via the official Iraqi export infrastructure. A resolution to the stand-off seemed far-fetched at this stage.
But despite Baghdad's anger over the oil majors going into Kurdistan, the row focused minds on both sides. Last month, it emerged that the KRG and Baghdad had agreed on a resumption of exports, and to an export quota to the coming year.
Significantly, they also agreed to intensify efforts to adopt a piece of stalled legislation that would resolve the oil dispute. The draft of what is known as the National Oil Law was rejected by parliament in 2007, and no revised version has emerged since.
With the new drive to compromise, the two governments put their heads together and set up a working group to get the law adopted last month. That group consists of senior officials from both sides, including the Kurdish energy minister, Ashti Hawrami, and will meet regularly.
"I hope we will meet a few times and we come up with a draft for the parliament to approve," said Mr Hawrami, who believes the law could come into force as early as this year.
Thamir Ghadhban, an energy adviser to the Iraqi prime minister and a former oil minister, agrees. "I am optimistic that we benefited from the lesson learnt in the last five years and we will put an end to this. We should have a new law. Either it will be done by the end of this year or the first quarter of next year."
If the law is not pushed past parliament soon, it will be delayed further by the forthcoming national elections, warned Mr Ghadhban.
For the Kurds, the benefits of a speedy resolution of the stand-off are clear. If companies are not guaranteed regular profits, they will leave the region.
"Investment in their upstream will be tailing off at some point when oil companies can't make a buck out of it," said Sam Ciszuk, an analyst at KBC Energy Economics.
The central government also has much to gain. Increased production in Kurdistan would help it to meet ambitious targets to grow its oil output, as well as swelling government coffers.
"A resolution of differences over governance of the hydrocarbon sector would open up the possibility of substantial growth also from the north of Iraq," said the International Energy Agency in a recent report, which also estimated that Iraq would double its production by 2020, and become crucially important in the race to meet growing global demand for crude.
Solving the stand-off would ease tensions in the ruling Iraqi coalition, while an oil law would streamline the running of the oil sector in the country at large.
For now, Iraq's government maintains that contracts handed to oil companies by the KRG are illegal, and says only Baghdad has the authority to make determinations over the country's natural resources. It had blacklisted the small international oil companies that preceded Exxon by going to Kurdistan from auctions for exploration blocks in the south of Iraq.
The hard line was because of anxiety over Kurdish aspirations for full independence. Scarred by the crimes committed against them during the Saddam Hussein era, the Kurds have a strong sense of national identity. If the contracts are declared valid, Baghdad fears, it could prompt further demands for autonomous decision-making that would eventually lead to a full Kurdish state.
The KRG has much to lose from a protracted deadlock, but it does have an ace up its sleeve that could change the dynamics of the oil game in Iraq. The Kurds have floated a plan to build a pipeline connecting their oilfields to Turkey, thus cutting their dependence on the export infrastructure running through the rest of Iraq.
The proposed pipeline will have a capacity of 1 million barrels per day, enough to accommodate the KRG's production growth targets to 2015. Little more than an ambition at present, it is nevertheless plausible thanks to a change in tack in Turkish policy towards the Kurds.
In the past, Ankara had been keen to avoid promoting the KRG's autonomy in Iraq, anxious about rising nationalism among the Kurdish minority in Turkey. Now Ankara seems to be more cooperative on the pipeline project.
"The pipeline strengthens Kurdistan's hand as long Turkey doesn't abandon it," said Mr Ciszuk.
A growing Kurdish assertiveness in Syria may cause the Turks to rethink their approach towards the KRG, he adds, as the Syrians fear that the call among Kurds for a unified state across Turkish, Iraqi and Syrian territory will become louder.
Nowhere are oil and politics more intertwined than in Iraq. If politicians from both sides do not reconcile their differences, they risk damaging the oil wealth that can lift the country out of the poverty brought about by decades of conflict.