The Iraqi government on Tuesday reached a deal with the Kurdish local authorities in the country's north to exchange oil from the autonomous region for a nearly 20 percent share of the national budget, officials said.

The deal resolves a months-long impasse that had undermined national unity amid the fight against the Islamic State group — a battle in which Iraqi soldiers and Kurdish peshmerga troops have joined forces against the Sunni extremists.

The agreement stipulates that the semi-autonomous Kurdish government will release 550,000 barrels of oil every day to the Iraqi oil ministry, more than half of which will come from the disputed Kirkuk oil fields, according to Iraqi Finance Minister Hoshyar Zebari.

The Kurds took control of the Kirkuk fields to prevent them from falling to the Islamic State group during its summer blitz that captured much of Iraq's north and west.

In exchange, the Kurds will receive the 17-percent share of the national budget allocated to their region, plus installments of as much as $1 billion to boost the capabilities of Kurdish peshmerga fighters battling the Islamic State militants.

Earlier this year, Baghdad cut the stake supposed to go to the Kurdish region — which in 2013 totaled about $12 billion, according to Zebari, a Kurd. The central government withheld the funds after the Kurds began transporting oil from fields inside the autonomous zone to Turkey against Baghdad's wishes.

"This deal is a win-win deal for both sides," Zebari told The Associated Press. "The (Kurdish government) needed more stability in its relations with Baghdad and the Iraqi government is going through very serious financial difficulties because of the drop in oil prices."

Iraq's Oil Minister Adel Abdul-Mahdi said in a televised statement that joint committees will be formed to follow up with the implementation of the agreement and address any lingering issues "in order to establish fruitful relations based on the constitution and the principles of partnership and fairness."

The regional Kurdish government says it needs that money to meet its growing security demands in the face of the threat by the Islamic State group, and to pay public-sector employees and fund much-needed infrastructure development.

The Kurds and Baghdad have feuded for years over a host of issues, chiefly among them the rights to oil resources in the north and disputed territory like the city of Kirkuk, which the Kurds want to add to their autonomous zone.

Since Prime Minister Haider al-Abadi came to power in September, the Kurds have pushed for a quick resolution, saying they will give him three months to resolve the oil dispute or they would boycott his government.

Last month, the government in Irbil, the Kurdish regional capital, agreed preliminarily to sell 150,000 barrels of oil per day to the federal government in return for a one-time payment of $500 million.

The U.N. envoy to Iraq, Nickolay Mladenov, said he looks forward to the "implementation of the agreement as swiftly as possible," noting that "only through direct and frank dialogue can agreements be reached that serve the interests of Iraq and the Iraqi people."