Image copyright AFP Image caption Lesbos is one of the Greek islands struggling to accommodate migrants and refugees
The EU's top court has ruled that Poland, Hungary and the Czech Republic broke EU law by refusing to take in refugees under an agreement to ease the burden faced by Italy and Greece.
EU leaders agreed to relocate 160,000 refugees EU-wide in 2015, from overcrowded camps in Italy and Greece.
The European Court of Justice says the three central European countries "failed to fulfil their obligations".
The EU Commission can impose hefty fines for breaches of EU law.
The Czech Republic accepted only 12 of the 2,000 refugees it had been designated, while Hungary and Poland received none.
The relocation scheme assigned quotas to the EU member states, and targeted mainly asylum seekers who had fled from Syria's devastating civil war.
The ECJ dismissed the countries' argument that the non-EU migrants could pose a security threat. That argument, the judges said, could only be applied in relation to a specific applicant, not to a whole group.
Italy and Greece have long accused other EU member states of a lack of solidarity for taking only relatively small groups of refugees from the temporary camps, which were hastily erected in the migrant crisis of 2015.
Media playback is unsupported on your device
Media captionChildren told the BBC they don't have enough food and are sleeping in the open