Supporters of the Justice and Development Party wave Turkish and European Union flags as then- Prime Minister Recep Tayyip Erdogan arrives at the Istanbul airport in December 2004. (MUSTAFA OZER/AFP/Getty Images)

Confetti and fireworks greeted Recep Tayypip Erdogan when he returned to Turkey in December 2004, flush with the good news that his country had been invited to start talks to join the European Union.

Addressing cheering crowds in the capital, Erdogan, then the prime minister, said the invitation was a sign of Turkey’s growing international clout.

After decades of effort, Turkey “will take its rightful place among modern and civilized countries,” he said at the time. “From now on, democracy will have a different meaning, and human rights and freedoms will be practiced in a more meaningful manner.”

But 13 years later, Turkey and Europe are locked in the bitterest of feuds, marked by threats, fiery epithets and petty slights that could mark the end of Turkey’s ambitious national project to gain coveted privileges as a full member of the European Union. Erdogan, who is now the president, suggested as much last month , telling CNN Turk that while Turkey could maintain its economic relations with Europe, “we may have the need to review ties at the political and administrative level.”

Beyond the heated rhetoric, both parties have much to lose from their fight, which threatens to further isolate Europe and Turkey at a moment when both are turning inward and succumbing to xenophobia and nationalist rhetoric, analysts said. The breakup would leave the European Union bereft of a Muslim-majority partner that might have served as a hopeful sign of inclusion and diversity, including for millions of Muslim immigrants living in Europe, and a counterbalance to right-wing, anti-immigrant parties that are gaining in prominence.

Turkish Prime Minister Tayyip Erdogan arrives at a Brussels hotel for talks about Turkey’s entry into the European Union in 2004. A relationship that was growing closer then is now severely strained. (Yves Herman /Reuters)

And as the distance between Turkey and its democratic allies grows, the Turkish state’s institutions are becoming more rigidly authoritarian, as its prisons fill and the tolerance for dissenting voices evaporates.

The schism could have also immediate repercussions, most notably for a European Union deal with Turkey to stem the passage of migrants headed to Europe. Turkish officials have repeatedly threatened to scuttle the deal. Last week, in a grim warning about the possible consequences, 11 Syrian refugees trying to reach Greece drowned when their boat sank off the Turkish coast, according to Turkey’s Dogan news agency.

The latest arguments have been sparked by recent events, including a referendum in Turkey this month that could change its system of government from a parliamentary system to what is known as an “executive presidency.” A “yes” vote in the referendum would allow Erdogan to run for an additional term, and possibly remain in office until 2029.

Turkish officials supporting the change have been prevented in recent weeks from addressing expatriate Turkish voters in Europe, drawing a furious reaction from Erdogan and his government that has included accusing the German and Dutch governments of Nazism. European officials, in turn, have become more openly critical of Erdogan’s government.

[Turkish battle over ‘executive presidency’ prompts tensions with the Netherlands and division at home]

Ambassadors have been summoned and national leaders vilified on front pages from Ankara to Amsterdam. The frenzied rhetoric has also raised safety concerns, for Turks living in Europe and for Westerners residing in Turkey. Erdogan issued a vague warning last month, saying that unless the Europeans changed their behavior, “no European, no Westerner will be able to take steps on the streets safely and peacefully,” local media reported.

As the frequency of the insults has moved beyond diplomatic crisis to unbridled hostility, it has laid bare tensions that had been building for years, analysts said.

Asli Aydintasbas, a Turk and a fellow at the European Council on Foreign Relations, said the recent, unusual flare-up was a sign of how severely the bond between Turkey and Europe has deteriorated. “There is room for controlled tension, but not this kind of out-of-control spat,” she said. “I think this relationship has very much changed course. It is no longer a real partnership.”

Sinan Ulgen, a visiting scholar at Carnegie Europe in Brussels, said the referendum campaign in Turkey “is accelerating this moment of reckoning — laying bare the perennially unbridgeable inconsistencies in the relationship.”

“It is becoming very difficult to continue with the pretense of Turkish accession” into the E.U. for several reasons, he said, including democratic backtracking in Turkey and the political dynamics in Europe. “Unfortunately, we have reached a possible turning point in the Turkey-European relationship.”

Turkey’s entry into the E.U. was always going to be a difficult proposition, he said. Turkey — a Muslim-majority country of 71 million people that was referred to derisively by many European leaders as “too big, too poor, too different” — always had more to prove than Eastern European countries that were incorporated in the E.U. enlargement process, he said.

Turkey’s effort to formally become part of Europe stretches back decades, to 1959, when the country first applied to join the European Economic Union, the precursor to the European Union, which was formed in 1993. European critics of Turkey’s accession highlighted “cultural difference” — a euphemism for its status as a Muslim-majority country — as well as its ongoing dispute with Cyprus and its human rights abuses.

After Erdogan’s Justice and Development Party took power in 2002, the government renewed its push for membership and took steps, including abolishing the death penalty, that led to the beginning of formal negotiations in 2005.

Over the next decade, Turkey’s bid proceeded in fits and starts, facing stiff resistance especially from Germany, the Netherlands and France. The moribund negotiations led to an “an accumulation of tension, frustration and disillusionment,” said Ulgen.

There are differences of opinion about where to lay blame for the current impasse.

Despite the obstacles, Turkey could have taken measures, including consistently upgrading its democratic standards, that would have thwarted the naysayers in Europe, Ulgen said. Instead, “the exact opposite happened. The obstructionism on the European side strengthened the hand of those in Turkey skeptical of this vision, for a variety of reasons that have to do with ideology, governance, culture and so on. Over time, they came to be more influential in charting the course for Turkey.”

Aydintasbas said the present, worsening relationship “was not a foregone conclusion” but rather the result of misunderstandings and missed opportunities over years.

“What would have happened had the Europeans been more willing to open the doors for Turkey, at a time when Turkey was desperately carrying out reforms?” she said. The last decade was an especially critical moment — a “high point” for Turkish democracy, between 2000 and 2008, when civilian leaders gained the upper hand over Turkey’s powerful military and enthusiasm for the European project in Turkey was at an all-time high.

But national leaders in Europe, including Angela Merkel in Germany and Nicolas Sarkozy in France, decided that Turkish accession was “not a good idea,” and in the years that followed, the accession effort stalled.

In July, a failed coup attempt in Turkey further doomed the relationship, as the Turkish government embarked on wide-ranging crackdown on enemies and dissidents while castigating Europe for not expressing a sufficient amount of solidarity. In November, the European Parliament passed a nonbinding resolution freezing the accession talks with Turkey.

After a visit to Turkey in March, the European Parliament’s rapporteur on Turkey, Kati Piri, wrote that “talking about Turkey joining the bloc under the current circumstances would lack credibility — especially in the wake of Erdogan’s unwarranted accusations that German and Dutch governments were following ‘Nazi practices.’ ”

For now, the two sides have settled on a transactional relationship that includes the migrant deal and a possible customs union that would promote free trade.

“Both sides know this is going to be it,” Aydintasbas said. “It suits the Turkish government because they don’t have to worry about building a democracy, at a time when they are waging battles against all enemies domestic and foreign.

“And it suits Europe,” she said. “There is domestic pressure in each and every country not to embrace Turkey.”

Read more:

As a new relationship is tested, Turkey keeps high hopes for Trump

Arrest of German journalist in Turkey strains relations between Erdogan and Merkel

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news