Britain and Ireland have been told they cannot send asylum seekers back to Greece because of the country's inadequate asylum arrangements.
A European Court of Justice ruling said no EU government could take it for granted that another member state's asylum procedures complied with fundamental rights - even though Europe is supposed to have a common asylum policy in place.
Under the policy - the so-called "Dublin 11" Regulation - asylum seekers entering the EU must apply for asylum in the first member state in which they arrive. If they move to another member state, the authorities there can return them to the first country.
But the Luxembourg judges have now ruled that the provision does not apply if an asylum applicant's fundamental rights risk being breached.
In the UK case before the Luxembourg court, an Afghan national, named as NS, came to the UK after entering Greece where he was arrested in 2008.
He was released four days later and given 30 days to leave the country. He did not ask for asylum, and later claimed he was arrested when trying to leave, finally being expelled to Turkey and held in "appalling" conditions for two months. He escaped and travelled to the UK where he applied for asylum.
The UK authorities ordered his return to Greece under "Dublin 11", but NS than launched a legal challenge on the grounds that his fundamental rights would be infringed in Greece.
In the Irish case, five unconnected people, originating from Afghanistan, Iran and Algeria, each entered the EU in Greece and were arrested for illegal entry. They did not seek asylum, but travelled to Ireland, and did apply for asylum.
They also resisted return to Greece because of inadequate asylum conditions.
The UK Court of Appeal and the Irish High Court asked the EU judges for a ruling on whether they could send the asylum seekers back.
The outcome was anticipated, with several EU countries having suspended returns to Greece following a similar ruling earlier this year in a case involving Belgium trying to return an asylum seeker to Greece.
The EU judges' verdict said: "An asylum seeker may not be transferred to a member state where he risks being subjected to inhuman treatment."
The Common European Asylum System, said the judges, was intended to make it possible to "assume that all the participating states observe fundamental rights and that the member states can have confidence in each other in that regard."
They acknowledged that the system would not work if the return of an asylum seeker was blocked just because of "the slightest infringement" of the norms governing asylum in the EU.
However, the ruling declared: "The member states, including the national courts, may not transfer an asylum seeker to the member state indicated as responsible, where they cannot be unaware that systemic deficiencies in the asylum procedure and in the reception conditions of asylum seekers amount to substantial grounds for believing that the asylum seeker would face a real risk of being subjected to inhuman or degrading treatment."
Conservative MEP Timothy Kirkhope said it was time to "get tough" with Greece.
"Of course, it is not right that genuine asylum-seekers are returned to a country where they face further persecution" he said.
"However, there is also now a clear incentive for people with other motives to enter the EU via Greece, safe in the knowledge that other countries are powerless to return them."
Mr Kirkhope, a UK immigration minister in the 1990s, said it was now up to the European Commission to take action against Greece for failing to apply basic standards expected of a European country.
He went on: "If the UK or France had such inadequate systems and poor asylum conditions as Greece, then I have no doubt the Commission would come down on us like a ton of bricks.
"This ruling was expected but it is still extremely frustrating. Western European countries are not trying to return people to some African dictatorship, but to another EU member state where respect for their basic human rights should be a given."
Mr Kirkhope added: "The EU needs to continue to assist Greece in dealing with the significant pressures it faces, but it should also back up its carrot with a stick to push Greece into ending the current unacceptable state of affairs.
"This is another case of how well-intentioned human rights law is being interpreted to the detriment of those countries that play by the rules, such as the UK, whilst allowing countries that fail to meet their obligations to see little consequence. It is simply not fair."
But Green MEP for London Jean Lambert welcomed the result, saying: "Today's judgment only serves to further highlight the importance of ensuring that fully-functioning, efficient and quality asylum systems are operating in all member states if trust between member states is to become a reality, and the fundamental rights of all individuals in the EU are respected."