Leaders of the European Union and Turkey aim to finalise a broad agreement at a Brussels summit next Thursday and Friday to pave the way to an end to Europe's migration crisis.

First, however, a number of legal obstacles must either be cleared or sidestepped.

Following are the three main issues complicating a deal by which Turkey would take back all refugees and migrants reaching Greek islands in return for cash to help Syrians in Turkey, the resettlement of some Syrians from Turkey to the EU, revived talks on Turkey joining the EU and easier EU visas for Turks:

EU visa liberalisation for Turks

The EU wants to waive visa requirements for Turks only once the Ankara government fulfils 72 conditions. A European Commission report of March 4 found 19 of those were already met and most of the others were met in part. Three notably need to be implemented: sign a pact with EU police agency Europol; adopt EU data protection rules; and waive visa requirements for all EU citizens whatever their nationality. While nationals of nine EU member states need visas to visit Turkey, it is citizens of Cyprus whose status may be toughest for Ankara to change.

At present, to enter Turkey, sponsor of the breakaway state in northern Cyprus since 1974, EU citizens from Cyprus must accept being registered as subjects of the "Greek Cypriot Administration of Southern Cyprus". Differences with Cyprus have long hampered EU-Turkish relations, although hopes have risen for a U.N.-brokered peace settlement to reunite the island.

Any agreement on visa waivers requires endorsement by the European Parliament, where many lawmakers are uneasy about the risk of Turks abusing short-stay rules or seeming to reward Turkey while accusing its leaders of turning more authoritarian.

Turkey as a safe third country

For Greek and EU authorities to deport people arriving on Greek islands back to Turkey without processing their claims for asylum, it is necessary to consider Turkey a "safe third country" -- ie neither the country of arrival nor the migrant's home country -- where they will be treated as refugees under the Geneva Convention. Such determinations are made not at EU but at national level and the plan is to carry out such expulsions under a bilateral "readmission" pact between Greece and Turkey.

But Greek officials have said it has as yet no list of safe third countries. And lawyers note that, although Turkey treats many refugees, notably Syrians, well, it has limited itself to applying the protections of the Geneva Convention only to people fleeing from Europe, not other parts of the world.

Deportation and resettlement

The United Nations top human rights official says the plan to send back to Turkey everyone, even Syrians, who lands without the right papers on Greek islands, risks consisting of illegal "collective and arbitrary expulsions". Under EU law, all those who claim asylum have a right to have their individual case considered, and to have an ability to appeal -- a process incompatible with swift mass deportations from remote islands.

The legal underpinning of any final accord on expulsions from Greece, as well as for the return to Turkey of migrants picked up at sea by NATO warships, may well come down to an EU or Greek declaration that Turkey is a safe third country capable of handling the relevant asylum claims.