October 31, 2017, will remain in history books as the day when—by a fortuitous coincidence—two dreams of independence collapsed simultaneously, for partly similar reasons.

On that day, Mas‘oud Barzani resigned after twelve years as president of the Kurdistan Regional Government (KRG), even as Carles Puigdemont, the president of the Government of Catalonia whom the Spanish government removed from office in late October, was giving a last-ditch press conference in Brussels, where he said he would remain for his own safety. Both leaders were the emblematic figures behind referendums on independence—respectively on September 25 and October 1. Both votes began amid great political enthusiasm and ended in political failure. If there are commonalities between the two cases, they fall into two different categories.

The first was a feeling among populations in both Iraqi Kurdistan and Catalonia that “their moment in History” had come, that “they were on the world map,” and that no coercion could make them back down in acting on such beliefs. Many Iraqi Kurds, in addition, had a strong sense that the West owed them for having successfully fought against the Islamic State.

The second similarity was massive overconfidence, which led both leaders to grossly misread the international scene. Barzani heeded neither the advice from Washington, nor the threats from Baghdad and regional powers such as Iran and Turkey. Joost Hiltermann of the International Crisis Group perhaps spoke for many when he argued that “Kurds have a long history of misreading America’s intentions.” For his part, Puigdemont had not measured accurately the support that Madrid would get from European capitals and European Union institutions, at a time when the EU’s solidity had been challenged by Brexit and substantial political divergences with Hungary and Poland.

The Kurdish and Catalan leaders also failed to grasp that the previous political orders would prevail, and this for a similar reason: fear of the unknown. An independent Iraqi Kurdistan would have sent shockwaves through Iran and Turkey and might have boosted Syrian Kurds’ hopes, while a new “Republic of Catalonia” would have set an unwanted precedent for other regions in Spain and in EU countries.

As a result, the KRG’s extensive autonomous powers are being rolled back, while Catalonia’s regional autonomy has been halted and a legal process launched by the Spanish judiciary against pro-independence Catalan officials. In both cases, frustrations and anger will loom large for years to come. Hopefully, violence will be contained.

For Iraqi Kurdistan, many complications lie ahead, but there are also factors playing in its favor. In the last two weeks, the KRG has lost control of most of the non-Kurdish territories outside its official jurisdiction, especially Kirkuk, Sinjar, and Qanaqin. As a result, the KRG has also lost about half of its oil exporting capacity. This adds to the structural problems of the KRG’s economy—an overdependence on oil exports and on imported products for its development. Given the current political uncertainties, economic prospects look even dimmer.

Yet, there is a strong interest from the United States, the EU countries, Russia, Turkey, and the Gulf countries to bring back normalcy to the KRG’s economy. European, U.S., Emirati, and Russian firms are still involved in the production and export of oil, while Turkey still operates the pipeline from Kurdistan to the Ceyhan terminal, which it has not closed despite threats to that effect. Turkey continues to conduct trade with the KRG, one of its best regional markets for manufactured goods and construction materials. And Turkish Airlines was making very good business with its (currently interrupted) flights to Erbil and Suleimaniyya, as were other operators.

Difficult negotiations lie ahead between Erbil and Baghdad, especially over border controls, oil revenue sharing, the future role of Peshmerga forces, and dispute settlement mechanisms. In addition, after Barzani’s resignation, political power in Erbil is now formally split between parliament, the prime minister, and the judiciary, while presidential and parliamentary elections have been postponed for eight months. These intrinsic difficulties will make dialogue even more delicate. The situation may be aggravated by Iran’s own political stakes in the region and Turkey’s delicate domestic political situation, which is currently driving a fiercely nationalistic narrative.

The period ahead will see “normalization” between Baghdad and Erbil, but it will not be simple. A potential danger is a clash between an overly triumphant central Iraqi government and the frustrated Kurds. Baghdad might be tempted to crush all signs of Kurdish autonomy, while the Kurds will now have to start negotiations from a weaker standpoint than before the referendum. On November 1, the KRG stressed the “common objectives of peace, stability and prosperity in the wider region” and called “on its regional and international partners to play a proactive role in preventing further violence and engage Erbil and Baghdad in a constructive dialogue in order to resolve all outstanding issues on the basis of the Constitution.”

If both sides accept it, neutral international assistance should be provided to identify the ways in which Iraq could play a new role with regard to external borders, while the KRG reorganizes its autonomous powers. The European Union has accumulated experience in the western Balkans on many of the issues at stake in northern Iraq and could provide technical support.

For both Iraq and Spain, the future must not be about central governments exacting revenge against the backers of independence, or a persistent nostalgia for independence from Kurds or Catalans. The real challenge will be whether there can be peaceful negotiations over the modalities of equitable coexistence within a political framework respectful of the identities of all the actors concerned.