The establishment of an independent Kurdistan — a decades-old dream for many people here — was starting to take shape. In a nonbinding referendum held by the Kurds three weeks ago, more than 92% of voters favored breaking away from Iraq.
But on Tuesday, the dream all but died.
The Kurdish troops known as the peshmerga peacefully withdrew from disputed territories outside the semiautonomous Kurdish region, including some that it had recently helped retake from the Islamic State extremist group.
The biggest blow to the Kurds was the loss of two major oil fields that had given the Kurdish region a large degree of financial autonomy since mid-2014, when Iraqi troops fled a sweeping advance by Islamic State only to have the peshmerga take over.
The Bai Hasan and Avana oil fields are near the city of Dibis and produce 300,000 barrels a day, or nearly half the total output of the Kurdish region, according to Assem Jihad, an Iraqi Oil Ministry spokesman. The Kurdish government had been extracting and selling its own oil and gas.
Iraqi troops took over the fields Tuesday without a fight or any loss of production capacity, Jihad said. Iraqi forces marched into Dibis unopposed, a soldier from the country's Counter-Terrorism Service said on condition of anonymity because he was not authorized to speak a reporter.
The story was much the same in other places that were seized by the government: The Kurdish forces abandoned their positions without firing a shot.
In the city of Sinjar, the ancestral home of the Yazidi minority, the army worked with a local militia to reestablish control.
"We entered after 2:30 in the morning and went into all the villages of Sinjar, and now we have stability," Murad Sheikh Kallo, the head of the Yazidi militia, said Tuesday. "We preserved public institutions and services and there was no trouble.
"We refuse to have any force here that does not submit to the central government," he said. "We refuse the presence of the Kurdish separatists."
Yazidis accuse the peshmerga of abandoning them in 2014, when Islamic State took over Sinjar, executed thousands of Yazidi men and boys and kidnapped Yazidi women to make them sex slaves.
The retreat Tuesday came a day after Iraq's prime minister, Haider Abadi, launched a military operation to retake the disputed areas, and Kurdish forces handed over the city of Kirkuk.
Massoud Haider, a Kurdish member of parliament, said the government takeover was part of a deal negotiated by Iran between the Patriotic Union of Kurdistan — a skittish partner of Massoud Barzani, the president of Iraq's Kurdish region — and Shiite-dominated paramilitary groups that are collectively known as Popular Mobilization Forces and backed by Iran.
In a statement Tuesday, Barzani seemed to blame the turn of events on the Patriotic Union of Kurdistan, which presumably negotiated for a role in the administration of the disputed areas.
"The Kurdish people will reach their blessed aim … sooner or later," he said.
At 15% to 20% of the population, the Kurds make up Iraq's largest ethnic minority. Their desire for independence has long been thwarted. Last month's referendum was roundly opposed by the government in Baghdad and internationally.
The United States vowed to remain neutral in the conflict between Iraq and the Kurdish regional government. It has relied on both Iraqi forces and the Kurdish troops in the fight against Islamic State.
"We are not taking sides," said Heather Nauert, a State Department spokeswoman.
After Iraqi forces took Kirkuk on Monday, hundreds of Kurds fled their neighborhoods. By Tuesday, they were returning.
"We thought there would be clashes, and a mortar doesn't care if you're an Arab or a Kurd," said Bassam Zangana, a 46-year-old plumber who returned with his family to the Kurdish-dominated Barood Khana neighborhood.
Though many stores in Kurdish neighborhoods remained closed, Zangana and other residents said they expected to return to work by Wednesday.
The subdued atmosphere in Kurdish neighborhoods stood in stark contrast to the celebrations on Kirkuk's aptly named Baghdad Road, where traffic was snarled by dozens of young men waving Iraqi, Shiite and Turkmen flags. Drivers would occasionally abandon their cars in the middle of the street for a quick celebratory dance.
"The Kurds are still our brothers, but the leaders were the problem," said Mohammad Hussein, a 23-year-old resident of Kirkuk who was draped with an Iraqi flag. "Thank God the Iraqi army came."