The European Union announced Thursday that it is taking the Czech Republic, Hungary and Poland to court for failing to accommodate their fair share of refugees under a plan agreed to by the 28-country bloc two years ago.

EU nations agreed in Sept. 2015 to relocate 160,000 refugees from Italy and Greece as the countries buckled under the arrival of hundreds of thousands of migrants that year.

Under the plan, Hungary, Poland and the Czech Republic were supposed to take in a combined 10,000 people.

But Hungary and Poland have taken none at all, while the Czech Republic has accepted 12. The EU's executive Commission sought reasons why but was given no satisfactory explanations.

Syrian refugees at a makeshift camp for migrants on the island of Lesbos, Greece

The Commission said Thursday that the three "remain in breach of their legal obligations" and "have given no indication that they will contribute to the implementation of the relocation decision."

Their cases are being referred to Europe's top tribunal, the Court of Justice.

The refugee relocation plan was adopted in a legally-binding vote by a majority of EU member states, but not the three refusing to take part.

The plan never worked well. As of last week, only around 32,000 refugees had been relocated in all.

The dispute has highlighted the deep divisions among Europeans over how best to handle the migrant wave, which saw more than 1 million people enter Europe in 2015, mostly from Turkey to the Greek islands and across the Mediterranean to Italy. It has also undermined trust among EU partners.

The Commission's second in command, Vice-President Frans Timmermans, said he did his utmost to avoid legal action and that the three could still do something about it as a few thousand people in the Greek islands remain eligible to be distributed.

"Going to court is always the instrument of last resort. That's not what we want," he said. "We hope we still find a way out through an act of participation by these three countries."

But Poland is intransigent. Polish Foreign Minister Witold Waszczykowski said the government was not changing its policy on migrants.

"Nothing has changed. Our position is clear: we do not agree with the solution that the European Union proposed two years ago," he told reporters Thursday.

Nigerian returnees from Libya disembark from a plane upon arrival at the Murtala Muhammed International Airport in Lagos, Nigeria, Tuesday, Dec. 5, 2017

However, the Czech Republic seemed more conciliatory, with newly appointed Prime Minister Andrej Babis told the local CTK news agency that he wants to negotiate with the Commission to get the legal action lifted.

In a separate move, the Commission also referred Hungary to the Court of Justice over two other laws, one on higher education and the other on non-governmental institutions.

In both cases, Hungary has failed to address EU concerns about the laws or amend the legislation to bring it in line with EU standards.

At the core of both laws are the Hungarian government's efforts to curtail the influence of Hungarian-American financier George Soros in Hungary.

Prime Minister Viktor Orban considers Soros a key political foe, mainly because of their diverging views on migration.

The law on nonprofits compels civic groups getting more than around $27,000 a year in funding from abroad to register themselves with a court and identify themselves as being "foreign-funded" on their websites and all publications. Many NGOs hit by the new law are partially funded by Soros.