European Union leaders on Friday agreed with Turkey a refugee deal which will see the opening of a new chapter in the country’s accession process in exchange for sending back refugees entering Europe via Greece.

Turkey’s Prime Minister Ahmet Davutoglu met all 28 EU leaders to seal the deal which they expect will stem the flow of refugees coming into Europe through Greece.

"The main objective was to prevent the deaths of children, women, youngsters [and] old people in the Aegean Sea and different parts of the neighborhood in order to discourage human smugglers and encourage legal migration," Davutoglu said.

He was speaking at a joint news conference with European Council President Donald Tusk and European Commission President Jean-Claude Juncker following a summit in Brussels on Friday.

Under the deal, all refugees and all migrants arriving in Europe via Greece after March 20 would be returned to Turkey after individual assessments that are in full compliance with international law.

"The agreement is in accordance with the law, there can be no doubt about that. It meets European and international requirements," Juncker said in response to criticism by the UN that the deal would be in breach of the right to protection.

In return, the EU would be expected to resettle Syrian refugees already in Turkish camps starting from April 4.

Turkish PM also said that Syrian refugees’ condition in Turkey was praised by many around the world.

Noting that a plan to give working permits to Syrian refugees living in Turkey was one of the first decisions after the November general election, Davutoglu said: “Any European leader would agree that this was a difficult decision.”

“We have [refugee] camps where 300,000 people have been living in the last five years,” he said adding that these camps had turned into villages and towns, some with schools or hospitals.

Syrian refugees are living with Turks side-by-side and there is no discrimination against them in the country, Davutoglu said.

Speaking at a news conference after the summit, Italian Prime Minister Matteo Renzi reiterated his country’s support for Turkey’s EU accession process, adding:

"At the end of a long discussion and reconciliation process, a realistic but difficult to obtain agreement has been reached. I can make a positive opinion on this agreement now, but the coming weeks will show us whether it is possible to be realized or not."

Renzi also said that EU leaders will feel that they have accomplished their duty if they rescue even one child with the refugee deal.

Also speaking to reporters after the summit, Germany’s Chancellor Angela Merkel said that Europe showed how it could overcome a difficult exam.

She said that all kinds of efforts should be made for refugees, especially those who live close to Turkey’s borders, so that they feel secure.

The EU has also agreed to accelerate Turkey’s accession process by opening Chapter 33 on Financial and Budgetary provisions by June 30.

Turkey is hosting the largest number of Syrian refugees in the world and has spent more than seven billion euros ($7.7 billion) meeting their needs, according to European Commission figures released last year.

Ankara has also requested visa-free travel for its citizens by the end of June, speeding up its accession talks and an additional three billion euros ($3.3 billion) to meet the needs of Syrian refugees in Turkey.

"The most important aspect is visa liberalization," Davutoglu said. "We hope [this] will happen before the end of June."

Turkey must fulfill 72 requirements in the visa roadmap, including issues such as migration management and public order and security.

So far, 37 requirements have been completed and 35 still remain. "We [Turkey] will fulfill all these requirements and we hope EU will do its own part," Davutoglu said.

Under the agreement, the EU has also agreed to speed up the disbursement of three billion euros already pledged to meet the needs of Syrian refugees in Turkey and to within one week identify jointly a list of concrete projects under the facility.

Over the past year, hundreds of thousands of refugees have crossed the Aegean Sea to reach Greece.

This has placed a huge strain on the austerity-hit EU member and threatened the EU’s internal open-border system, as countries to the north of Greece impose frontier restrictions.