The following article was originally published in The New York Times.

BAGHDAD — The man who led an independence push for the Kurdish region of Iraq for more than a decade announced on Sunday that he would quit as president. The move is the latest fallout from an independence vote that many Iraqi Kurdish leaders now see as a catastrophic blunder costing them their economic and political self-reliance.

Massoud Barzani, the region’s president since 2005, made the announcement in a bitter speech, his first public response to the sustained retaliation from the Baghdad government after the Sept. 25 referendum.

Mr. Barzani did not apologize for the vote, which was opposed by Washington and most international leaders.

He blamed what he called treason by fellow Kurds and the fickleness of his American allies who helped train and equip his security forces for the downturn of Kurdish fortunes. He said that despite leaving the presidency, he was not resigning from politics, and he vowed to stay active in pushing for Kurdish statehood.

“I’m a pesh merga and will continue to do whatever is needed and will be with my people in its struggle for independence,” Mr. Barzani said, referring to the band of Kurdish fighters that he helped transform from a guerrilla force in the 1980s against Saddam Hussein to the established security unit that until October was considered almost an unassailable force defending Kurdish autonomy.

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 several major oil fields, 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.

This article originally appeared in The New York Times.