Less than a month ago, Masoud Barzani was riding high. More than 90 percent of voters had backed his call for independence in a 25 September referendum. The Iraqi Kurdish president's forces controlled large areas of oil-producing Iraq. His legacy as a national leader seemed assured.

Three weeks later, Iraq forces are back in control of Sinjar and the oil-rich Kurdish "cultural capital" of Kirkuk, Iraqi Kurdistan has lost its primary source of income to Baghdad, and Barzani is facing calls to resign.

In hindsight, the referendum was the worst decision he has made in his decades-long career. But behind the swift reversal of fortunes lay a series of missteps, internal rows and gambles that analysts say turned a dream of statehood into a disaster.

The president states that some people from a certain political party had unilaterally paved the way for such an attack - Masoud Barzani, KRG president

In the last three days, peshmerga fighters abandoned their positions as Iraqi army forces pushed into areas controlled by the Kurdistan Regional Government but which lay outside its original borders; Makhmour, Diyala, Bashiqa, Gwer and Kirkuk, among others.

The loss of the Bai Hassan and Avana Dome oilfields on Tuesday is potentially the most damaging development - the fields, controlled previously by KDP peshmerga, were responsible for 280,000 of the KRG's total of 600,000 barrels a day, throwing the statelet's economic independence into doubt.

That turnaround in fortunes came as the Kurdish political establishment fractured along party and geographical lines. On Tuesday, Barzani blamed the PUK for the shocking setbacks in the field.

"In reference to the recent events in Kirkuk, the president states that some people from a certain political party had unilaterally paved the way for such an attack," he said.

Some in the PUK, in response, said it was the recalcitrance of Barzani's Kurdistan Democratic Party, or KDP, and refusal to negotiate with Baghdad which pushed the Iraqi government to reclaim its land by force.

Burnt Kurdistan flag is seen in Kirkuk (Reuters)

Patrick Osgood, former Kurdistan bureau chief at Iraq Oil Report, said the result is a KRG government in chaos, and its future far from secure.

"We can essentially forget about the KRG as a cohesive, policy-making, security-implementing government. It does not exist in any real sense," he said.

"You have a rump KDP-dominated government in Erbil and you have the PUK in Suleimaniyah which is now more or less fully on board with the federal government."

Iraqi Kurdistan has always been divided between the KDP and the PUK, with the former controlling the capital Erbil and the latter controlling the second city Suleimaniyah.

We can essentially forget about the KRG as a cohesive government. It does not exist. - Patrick Osgood, analyst

Although an uneasy unity had been built in recent years as Kurds united against the Islamic State group, the two camp appears to be fracturing once again.

"The PUK/KDP split is the most important factor in explaining what happened in Kirkuk," said Nate Rabkin, the managing editor of Inside Iraqi Politics.

"One of the things that makes it hard to predict what will happen, even in the short term, is that the united front of the Kurdish parties has broken down completely."

He said almost no one would have predicted such disagreements could have led to the loss of territory, and the integrity of the Kurdish region.

But the PUK had always been lukewarm on Barzani's independence referendum, and his animosity towards Baghdad.

While it went along with the poll and supported the Yes campaign - unlike the larger Gorran party - the PUK avoided taking the hardline politics of Barzani, and was open to agreeing deals that would see the remit of the referendum changed or the date moved.

The PUK have also always had closer links to Iran - the Iranian foreign minister, Mohammed Javad Zarif, attended the funeral of the late PUK leader Jalal Talabani last month, while Quds Force leader Qassem Suleimani visited his tomb over the weekend.

This has made it easier for the KDP to pin accusations of a connection to Iran on the party, though the leadership have been keen to deny there was any deal with the Iraqi forces.

Internal tensions

In recent months, the PUK has seen its own internal tensions - the former KRG prime minister, Barham Salih, deputy president Kosrat Rasul and Najmiddin Karim, Kirkuk's governor, have all expressed dissatisfaction with the PUK leadership.

Salih and Rasul expressed a desire to form an alternative decision-making body within the party in 2016, while Karim - a much-hated figure in Baghdad - became increasingly close to the KDP and became a strong advocate for the independence referendum.

With Salih eventually resigning from the party, the PUK is now largely dominated by the Talabani family - ironically embracing the kind of the dynastic politics that the party was originally formed in 1975 in opposition to.

“They’ve not been happy with the KDP [in Kirkuk]. And what you’ve had is certain figures in the PUK coming more over to the KDP side recognising that until very recently the KDP has had the upper hand and holds all the cards," said Osgood.

Those divisions seem certain to grow wider as Kurdistan loses more chunks of land to the central government in Baghdad - and could even result in hostilities between the Kurdish factions.

Kamal Chomani, a non-resident fellow at the Tahrir Institute for Middle East Policy, said such a scenario was possible, although not on the scale of the 1994 civil war that almost saw the fledgling autonomous Kurdish Iraq region destroyed.

"There’s a fear that apart from losing the disputed areas, there is the threat that the Kurdistan could go back to the old days of having two administrations, the PUK and KDP, and that might be a better choice than deteriorating relations between the KDP and PUK," he said.

"Because if the current situation continues I think there will be clashes between the PUK and KDP."

On the table at the moment is the possibility that political power could - as in the past - be divided between Erbil and Suleimaniyah, with the latter once again becoming closer to Baghdad and seeking to restore economic ties.

Shia Popular Mobilisation Units (PMU) celebrate on the outskirts of Kirkuk (Reuters) That scenario would present problems in terms of the bureaucracy, however. The Kurdish regions are bound up within the framework of the KRG and attempts to disentangle them now could lead to serious administrative problems, warned Rabkin.

"You’ll have questions if you work in schools in Suleimaniyah - what does the Kurdistan administration in Erbil want you to do, can Baghdad arrange payments in Suleimaniyah that don’t go through Erbil?" he said.

"It will make it very hard for them to function separately."

Chomani said that it was possible that there could be a positive outcome as a result of the current tensions, however - political and social reform in Kurdistan and the end to Barzani's political dominance.

"There is a possibility that Gorran, Dr Barham Salih, the Kurdistan Islamic Group, the Kurdistan Islamic Union and the majority of the PUK may be united to put an end to Barzani’s hegemony and grip on power," he said.

"The other political parties in the Kurdistan region who have been marginalised, they may get stronger and they may push for economic reforms, social justice, democracy and rule of law."

Barzani's dream of statehood lies in tatters. What comes next could leave Kurdish Iraq more divided, weaker and more dependent on outside forces than ever.