The scheme was triggered as an emergency response from Italy and Greece, the main countries for the arrival of migrants landing in Europe. Prior to that, the EU relied on the so-called Dublin rules, which stipulate that migrants must apply for asylum in the EU state at the point of entry.
Since the scheme came into force, migrant flows from the Middle East have declined, thanks namely to a controversial deal the EU signed with Turkey to send back refugees. However, the number of migrants arriving in Italy from Africa this year has continued to be in the tens of thousands.
Based on the European Commission's policy paper, each country's quota is based on "objective, quantifiable and verifiable criteria that reflect the capacity of the member states to absorb and integrate refugees."
Particular weighting was given to each member state's population size, and thus its capacity to absorb refugees, and gross domestic product, which served as a reflection of how well refugees would be able to integrate into the economy.
This meant that countries such as Germany and France were due to take in just around 20 and 15 percent of all migrants respectively, while newer EU states, such as Hungary and Romania, were due to take in just under two and four percent respectively.
The goal: Survival
A journey combined with misery as well as dangers for the body and the soul: In their escape from war and suffering, hundreds of thousands of people, mostly from Syria, traveled to Greece from Turkey in 2015 and 2016. There are still around 10,000 people stranded on the islands of Lesbos, Chios and Samos. More than 6,000 new arrivals were recorded this year from January to May.
On foot to Europe
In 2015 and 2016, more than a million people tried to reach Western Europe from Greece or Turkey over the Balkan route - through Macedonia, Serbia and Hungary. The stream of refugees stopped only when the route was officially closed and many countries sealed their borders. Today, most refugees opt for the dangerous Mediterranean route from Libya to Europe.
This picture shook the world. The body of three-year-old Aylan Kurdi from Syria washed up on a beach in Turkey in September 2015. The photograph was widely circulated in social networks and became a symbol of the refugee crisis. Europe could not look away anymore.
Chaos and despair
Last-minute rush: Thousands of refugees tried to get into overcrowded buses and trains in Croatia after it became known that the route through Europe would not remain open for long. In October 2015, Hungary closed its borders and installed container camps, where refugees would be kept for the duration of their asylum process.
A Hungarian journalist caused uproar in September 2015 after she tripped a Syrian man who was trying to run from the police at Roszke, near the Hungarian border with Serbia. At the peak of the crisis, the tone against refugees became coarser. In Germany, attacks on refugee homes increased.
No open borders
The official closure of the Balkan route in March 2016 led to tumultuous scenes at border crossings. Thousands of refugees were stranded and there were reports of brutal violence. Many tried to circumvent border crossings, like these refugees at the Greek-Macedonian border shortly after borders were closed.
Symbol of horror
A child covered in blood and dust: the photograph of five-year-old Omran shocked the public when it was released in 2016. It became an allegory of the horror of the Syrian civil war and the suffering of the Syrian people. One year later, new pictures of the boy circulated on the internet, showing him much happier. Assad supporters say the picture last year was planted for propaganda purposes.
The unknown new home
A Syrian man carries his daughter in the rain at the Greek-Macedonian border in Idomeni. He hopes for security for his family in Europe. According to the Dublin regulation, asylum can be applied only in the country where the refugee first entered Europe. Many who travel further on are sent back. Above all, Greece and Italy carry the largest burden.
Hope for support
Germany remains the top destination, although the refugee and asylum policy in Germany has become more restrictive following the massive influx. No country in Europe has taken in as many refugees as Germany, which took in 1.2 million since the influx began in 2015. Chancellor Angela Merkel was an icon for many of the newcomers.
Emergency situation in the camps
In France's north, authorities clean up the infamous "jungle" in Calais. The camp caught fire during the evacuation in October 2016. Around 6,500 residents were distributed among other shelters in France. Half a year later, aid organizations reported many minor refugees living as homeless people around Calais.
Drowning in the Mediterranean
NGO and government rescue ships are constantly on the lookout for migrant boats in distress. Despite extreme danger during their voyage, many refugees, fleeing poverty or conflict in the home countries, expect to find a better future in Europe. The overcrowded boats and rubber dinghies often capsize. In 2017 alone, 1,800 people died in the crossing. In 2016, 5,000 people lost their lives.
No justice in Libya
Hundreds of thousands of refugees from Sub Saharan Africa and the Middle East wait in Libyan detention camps to cross the Mediterranean. Human smugglers and traffickers control the business. The conditions in the camps are reportedly catastrophic, human rights organizations say. Eyewitnesses report of slavery and forced prostitution. Still, the inmates never give up the dream of coming to Europe.
Has the scheme succeeded?
One obvious shortcoming in the EU's relocation scheme was the total numbers of participants.
The relocation and resettlement initially pledged to subject some 100,000 migrants to transnational quotas, only a fraction of the total number admitted into the EU. However, earlier this year that target was dropped to just 33,000 as the estimated number of eligible migrants was substantially revised.
Two years on, just 28,000 migrants have been relocated under scheme, as authorities struggle to get people into the scheme, citing administrative bottlenecks, delays and strict demands from receiving states.
Prior to the European Court of Justice's decision Wednesday ordering all states to adhere to the quota, a handful of central European states had effectively refused to take part in scheme. Slovakia had taken in just 16, the Czech Republic 12, and Hungaryand Poland none at all.
The scheme is scheduled to end this month on September 26, although anyone arriving in a European Union member state before that date is eligible for relocation. According to the ECJ ruling, countries that have not met their quota will be required to settle migrants, even once the scheme has ended.
It means that Slovakia, the Czech Republic, Poland and Hungary will likely have to settle around 3,000 migrants between them as part of the quota.