BAGHDAD/KIRKUK (Reuters) - The Baghdad government recaptured territory from Kurds across the breadth of northern Iraq on Tuesday, making startlingly rapid gains in a sudden campaign that has shifted the balance of power in the country almost overnight.

In the second day of a lightning government advance to take back towns and countryside from forces of the Kurdish autonomous region, Kurdish troops known as Peshmerga pulled out of the long disputed Khanaqin area near the Iranian border.

Government troops took control of the last two oilfields in the vicinity of Kirkuk, an oil city of 1 million people which the Peshmerga abandoned the previous day in the face of the government forces’ advance. A Yazidi group allied to Baghdad also took control of the town of Sinjar.

Baghdad’s military operation has redrawn the map of northern Iraq, rolling back gains by the Kurds who infuriated Baghdad last month by holding a referendum on independence.

Iraqi Prime Minister Haider al-Abadi said on Tuesday the referendum “is finished and has become a thing of the past”.

Addressing a news conference in Baghdad, he called for a dialogue with Kurdish leaders “under the constitution”.

Kurdish Regional Government (KRG) President Masoud Barzani said the vote for independence “won’t be in vain”. He did not call for dialogue, but added, “Kurds have always been against waging wars and have worked in pursuit of peace.”

The KRG governs three mountainous northern provinces making up the autonomous region. It has also held a wide crescent of additional territory in northern Iraq, much of which they seized after helping drive out Islamic State militants since 2014.

Abadi ordered his troops on Monday to raise their flag over all Kurdish-held territory outside the autonomous region itself. They achieved a swift victory in Kirkuk, reaching the center of the city in less than a day.

The fighting in one of Iraq’s main oil-producing areas has helped return a risk premium to oil prices. After months of range-bound trading, benchmark Brent crude is now above $58 a barrel, up almost a third from its mid-year levels.

Oil officials in Baghdad said all the fields near Kirkuk were working normally on Tuesday after the last came under central government control. Kirkuk, situated just outside the KRG autonomous region, is the base of Iraq’s Northern Oil Company, one of the two giant state energy firms that provide nearly all government revenue.

Oil minister Jabar al-Luaibi said Baghdad would now try to nearly double the output of the Kirkuk oil fields to more than 1 million barrels per day.

DILEMMA FOR WASHINGTON

The Iraqi army advances create a dilemma for Washington, which has armed and trained both sides in its successful campaign to drive Islamic State insurgents out of Iraq.

“We don’t like the fact that they’re clashing,” U.S. President Donald Trump told reporters at the White House on Monday. “We’ve had for many years a very good relationship with the Kurds as you know, and we’ve also been on the side of Iraq.”

So far most of the advances appear to have come unopposed, with Kurds withdrawing before government forces move in. There have been reports of just one serious battle, in the early hours of Monday on the outskirts of Kirkuk.

The U.S. military said on Tuesday it had received mixed accounts of the death toll in that clash, with between three and 11 combatants killed.

Slideshow ( 10 images )

The International Committee of the Red Cross said the transfer of control appeared to have taken place with a minimum of fighting, with the number of wounded no higher than in the dozens. ICRC regional deputy director Patrick Hamilton told Reuters that he was concerned roads were closed, especially access to Mosul, the former Islamic State urban battlefield where hundreds of thousands of people still depend on aid.

In Kirkuk, one of Iraq’s most diverse cities, members of the Turkmen ethnic group who opposed Kurdish rule celebrated on Monday, driving through the streets firing weapons in the air.

By Tuesday, the once ubiquitous green, red and white Kurdish flag with a blazing yellow sun had vanished from the streets. U.S.-trained Iraqi special forces and local police patrolled to maintain order. Markets, shops and schools were open as normal.

Some Kurdish families who had left the city on Monday were already returning home. They said thousands of Kurdish fighters in convoys formed a long queue in efforts to flee Kirkuk towards the Kurdish regional capital Erbil, clogging the road and making it difficult for civilians to leave.

Slideshow ( 10 images )

TOUGH TERRITORIAL LOSS

For the Kurds, the loss of territory, particularly Kirkuk, which Kurdish folklore views as the heart of their homeland, is a severe blow just three weeks after they voted to declare the independent state that had been their goal for decades.

“Our leaders abandoned us in the middle of nowhere. Our future is dark,” said retired Kirkuk teacher Malla Bakhtiyar.

He said he tried to escape on Monday but returned with his wife and sons after an Arab neighbor phoned, begging him not to leave and assuring him the city was safe.

University lecturer Salar Othman Ameen blamed the Kurdish authorities for calling the independence referendum prematurely.

“We feel broken now. The referendum was a catastrophic decision ... Our Kurdish leadership was supposed to think of the consequences before moving along with independence vote. Now we have lost what we have achieved over three decades.”

The setbacks led to recriminations among the two main Kurdish political parties - the KDP and PUK, which each control separate units of Peshmerga.

Barzani said political rivals had ordered the withdrawal of Kurdish forces from Kirkuk, and officials in his KDP accused the PUK of his long-time rival Jalal Talabani of “treason” for abandoning the city.

Talabani, who served as ceremonial Iraqi president in Baghdad from 2003 to 2014, died two weeks ago. His widow denied blame for the fall of Kirkuk and said her party had tried to avert the advance through contact with U.S. and Iraqi officials.

The advances were a second resounding triumph for Abadi, the soft-spoken Iraqi prime minister, months after his forces recaptured Mosul from Islamic State. Abadi had faced threats from Iran-backed Shi’ite armed groups to take matters into their own hands if he did not act decisively to take on the Kurds.

“If elections were held tomorrow, I would vote with 10 fingers for Abadi. He succeeded in keeping Iraq a single state,” said Adel Abdul Kareem, a Baghdad lawyer.

“When Kurdish leaders were threatening Baghdad, Abadi was always smiling. We did not expect he was hiding a tornado behind this smile. He proved he was a smart leader, and with his wisdom he won against Masoud (Barzani) with a knockout in the second round.”

For the Kurds, the loss of Kirkuk restores the status quo in place before they seized it in 2014, which saw their self-ruled region prosper under an Iraqi constitution that guaranteed them a fixed percentage of Iraq’s total oil income.

Control of Kirkuk and its oil had made it seem more plausible for them to break away; without it, independence is problematic, since they would be financially worse off than inside Iraq with a share of its overall oil income.