BRUSSELS — A top European Union legal adviser denounced Hungary and Slovakia on Wednesday for refusing to participate in a plan devised in 2015 to relocate migrants from Greece and Italy as the migration crisis reached its height.
The legal adviser, Yves Bot, an advocate general for the Court of Justice of the European Union, blamed Hungary and Slovakia for “partial or total failure” in the “fair sharing of burdens” in the crisis, according to a summary of his opinion.
A verdict is still to be issued in the case, but judges usually follow their advisers’ opinions; if they do so this time, Hungary and Slovakia could eventually be ordered to pay fines.
The case has highlighted the deep divide in the European Union over the question of migration. Many member states in Central and Eastern Europe are intensely opposed to a push to oblige them to accept quotas of migrants from the Middle East and North Africa.
The relocation rule was introduced to try to relieve the burden on Greece and Italy, where migrants — many of them fleeing the war in Syria — reached the European Union in huge numbers in 2015 and 2016.
The European Union was correct “to adopt a provisional measure for the mandatory distribution between member states of persons in need of international protection” because it was “necessary to provide an effective response to the migration crisis,” Mr. Bot wrote, according to the summary.
In a separate case that also underlined the tensions between Brussels and Central and East European states over migration, Dimitris Avramopoulos, the European commissioner for home affairs, warned the Czech Republic, Hungary and Poland for ignoring the relocation rules.
The Commission began that case in June on the grounds that Hungary and Poland had taken no refugees, and that the Czech Republic had stopped participating in the program.
“If these member states decide to change position, we are ready to work with them to address their concerns,” Mr. Avramopoulos told a news conference in Brussels. “We don’t want to go on like this,” he added.
The legal action could also eventually result in fines from the Court of Justice for the countries involved.
Mr. Avramopoulos said the pace of relocation had significantly increased this year, with more than 3,000 transfers in June from Italy and Greece to other member states, including Finland, France, Germany and Sweden.
That still leaves more than 25,000 people eligible for relocation, according to estimates by officials at the European Commission, the executive arm of the European Union. The program formally ends on Sept. 26, but migrants arriving in the European Union until that date can qualify.
Also on Wednesday, judges at the Court of Justice upheld a decision by Austria and Slovenia to return people to Croatia during the migration crisis.
The ruling reflected a strict interpretation of the European Union’s rules, which require refugees to apply for asylum in the first European Union member state they enter.
The decision could prompt further criticism of an earlier move by Chancellor Angela Merkel of Germany to waive the rules and allow about one million migrants to apply for asylum in her country even though they had entered the bloc in other member states.
However, the court also ruled that member states could “unilaterally or bilaterally in a spirit of solidarity” decide to examine applications for international protection lodged with them, appearing to provide legal backing for Ms. Merkel’s actions.
The case that was decided on Wednesday involved a decision by the Croatian authorities to transport a Syrian national and members of two Afghan families to the Slovenian border.
The Syrian subsequently applied for asylum in Slovenia, while the Afghans applied for similar protection in Austria.
Courts in Austria and Slovenia asked European judges whether Croatia, as the member state where the migrants had arrived, should take responsibility for determining their claims.
The judges ruled that Croatia did bear responsibility, even in the case of “exceptional circumstances characterized by a mass influx of displaced people into the E.U.,” according to a summary of the court’s decision.
European officials said on Wednesday that they now expected the migrants to be returned to Croatia.
Mr. Avramopoulos emphasized the need to overhaul the existing system to deal with big influxes of migrants in the future and to try to avoid squabbling between member states.
The “system as it stands has significant shortcomings,” he said, because it was “not designed for exceptional circumstances such as those that we have experienced in 2015 and 2016.”