Mr. Barzani’s belligerent tone came after weeks of humiliating battlefield defeats for Kurdish fighters against overpowering force deployed by Prime Minister Haider al-Abadi of Iraq in retaliation for holding the referendum. The Kurdish government has also lost its main economic assets and , and has been met with almost complete international isolation.
The setbacks have given the Kurds a significantly weakened hand in negotiations between Iraqi commanders and their Kurdish counterparts to codify the sharply changed balance of power between the two sides.
The talks, mediated by United States military officers, convened after Mr. Abadi declared a temporary end to military operations to forcefully seize the border crossings with Turkey, Iran and Syria.
People close to the negotiators say Baghdad is nearing an agreement with Kurdish commanders that would have federal forces take over the border crossings, and fundamentally recalibrate how the region’s oil is exported, a revenue source that is essential to Kurdish dreams of self-reliance.
Such an agreement would be the steepest decline in Kurdish political fortunes since the group gained autonomy from Baghdad after the 1991 Gulf War.
The resignation of Mr. Barzani, who has not named a successor, leaves open the question of who else — either in his ruling Kurdistan Democratic Party or family — has the authority to approve such a deal.
Mr. Barzani served for two four-year terms as president, the maximum allowed under Kurdish law. He received a two-year extension in 2013 because of security fears amid the rise of the Islamic State in the region, but he has remained in power well beyond that time without legal justification.
Mr. Barzani’s government recently delayed elections that were scheduled for Nov. 1 — the first elections since 2013 — fueling rumors that the president planned to remain in office indefinitely.
In his speech on Sunday, Mr. Barzani did not clarify what his future political role would be.
Since taking up the presidency in 2005, Mr. Barzani has concentrated significant power in that office, while also placing close members of his family in critical leadership positions. A nephew is regional prime minister, and a son is in charge of the region’s security apparatus.
At Sunday morning’s regional parliamentary session in Erbil, lawmakers discussed Mr. Barzani’s instructions in his resignation letter to distribute his presidential powers between the prime minister’s office, which is held by his nephew; Parliament itself, which is dominated by his political party; and the judiciary.
Tempers flared in the course of the debate. A pro-Barzani lawmaker punched a Kurdish opposition lawmaker who had criticized Mr. Barzani’s record as leader, leading to a fracas and a delay in proceedings.
After sunset, as lawmakers continued their work, hundreds of club-wielding men descended on the regional Parliament, trapping dozens of politicians inside. Some members of the mob attacked local journalists covering Parliament. Local news media outlets reported hearing gunshots inside, but there were no immediate reports of injuries.
The violence drew condemnation from Sarwa Abdul Wahid, the parliamentary leader for the opposition Goran party and a vocal critic of Mr. Barzani and his party.
“What happened this evening at Parliament was a terror act and the K.D.P. is morally responsible for it,” Ms. Abdul Wahid said, referring to the ruling party. “We are witnessing the destruction of our whole legislative establishment in the region.”
The speaker of the parliament, Yusef Mohammed, blamed “thugs and anarchists” for the violence.
The standoff continued after midnight, with some pesh merga security commanders trying to help lawmakers evacuate the building. But the mob insisted that Goran lawmakers apologize for what they called disrespect shown to Mr. Barzani.
Kurdish Leader Quits, Latest Fallout From Much-Criticized Independence Vote – New York Times