Europe and Turkey have been negotiating for decades on the kind of relationship they want, and they're nowhere close to a final deal on that big question.

The limited agreement announced Friday on migrants reflects the relationship they have by default: mutual dependency that forces them to cooperate when faced with a crisis.

Europe needs Turkey to be a buffer that halts the surge of Syrian refugees, and more broadly, limits Middle Eastern chaos from spilling over into Europe.

Turkey needs greater access to Europe's markets and was also swayed by the billions of dollars the European Union offered to help the Turks cope with the nearly 3 million refugees it has hosted. Turkey also demanded, and received, a lifting of visa restrictions on Turks entering the European Union.

If it works as planned, Greece will start sending back Syrian migrants who are arriving by sea from Turkey. For every one of these undocumented Syrians sent back, Europe will accept one Syrian asylum seeker in Turkey who has gone through the official channels. Meanwhile, Turks will be able to travel more freely in Europe.

Both sides compromised and it marked a victory for cooperation on a difficult issue. The main criticism has come from human rights groups, who say it short-changes refugees.

Yet even as the deal was announced, the underlying Europe-Turkey friction was evident in testy remarks by Turkey's President Recep Tayyip Erdogan.

"At a time when Turkey is hosting 3 million (migrants), those who are unable to find space for a handful of refugees, who in the middle of Europe keep these innocents in shameful conditions, must first to look at themselves," Erdogan said in televised speech Friday.

So what are the prospects that Turkey will ultimately join the EU?

Well, there's a lot of history here.

Turkey first signed a cooperation agreement with the European Economic Community, the forerunner of the EU, way back in 1963. Turkey submitted an application for full European Union membership in 1987.

In the nearly three decades since, the sides have negotiated in fits and starts, with frequent pauses, periodic recriminations and occasional progress. The European Union has expanded dramatically during this time and now has 28 members, though there's no sign Turkey will be added any time soon.

The two sides must work out 35 separate issues, or chapters. They've only reached agreement on one, and most have never been opened for negotiation.

"This contrasting mix of conflict and cooperation has rested at the heart of the contested identity construction of both Turkey and Europe from the very outset," writes Nathalie Tocci in a paper for the Brookings Institution.

"True to history, Turkey's relations with the European integration project have been dense, contested, and tortuous since the outset," she adds. "Despite their intensity and duration over the decades, the end point of the relationship remains unknown to this day."

In principle, most European countries, as well as the United States, back greater Turkish integration in Europe for political, economic and military reasons. Turkey is the bridge to the Middle East. It already has deep trade ties with Europe and is a key member of NATO.

But in reality, the parties tend to irritate one another with regularity.

Europe frequently condemns Turkey's human rights record, and says the Turks will have to meet European standards when it comes to labor laws and judicial practices to join the EU.

The European criticisms are increasingly aimed at Erdogan, saying he has made Turkey less democratic and more authoritarian during more than a decade in power.

Erdogan chafes at his critics, raises the issue of Turkish pride and says his country will not take dictation from Europe.

Whenever relations get badly frayed, pressing matters tend to bring them back together.

The U.S. and European states lobbied Turkey for months to win permission last summer to use Turkey's Incirlik Air Base as a launching pad for air strikes against the Islamic State in Syria.

NATO has welcomed this Turkish assistance, though the fight against ISIS has itself become a point of contention.

The U.S.-led coalition has worked closely with Kurdish forces in both countries. But Turkey has stepped up military action against Kurds on several fronts, from southeast Turkey to northern Syria and northern Iraq.

In short, all the signs point toward a Turkey-EU relationship that's likely to be difficult, but one that neither side can walk away from.

"While both Turkey and the EU are in the same metaphorical boat, the boat is on a journey whose destination is unknown," writes Tocci.

Copyright 2016 NPR. To see more, visit