With Austria's limit on asylum seekers nearing, its interior minister threatened Wednesday to take Hungary to the EU's highest court over refusal by Budapest to accept migrants turned back by his country.

Interior Minister Wolfgang Sobotka's comments marked a sharp turn in Austrian tactics, reflecting the failure of months of attempts by his country to persuade Hungary to accept migrant returns.

The warning comes as Austria's government moves closer to passing a law that would shut its borders to asylum seekers once their number reaches 37,500 this year. Government statistics show nearly 29,000 people had applied for asylum in Austria this year by the end of July.

Sobotka suggested that unless Hungary changes its mind, Austria would go to the International Court of Justice over the issue. He told state broadcaster ORF that any country "permanently breaking the law (must) ... reckon with consequences."

EU law says that refugees are the responsibility of the member country where they first entered Europe. But that rule has been suspended for Greece, the point of arrival for most migrants, because the court has ruled that overcrowding and other conditions there do not meet human rights standards.

Hungarian officials say, however, that returnees who entered Austria from their country are not their concern, citing the rule mandating that countries of first entry are accountable.

The draft law that would cap the number of migrants allowed to seek asylum this year at 37,500 was finalized Tuesday and now will undergo a four-week review period by NGOs and rights organizations before it is put to a parliamentary vote by the center-left government. Parliamentary approval is expected.

Imposing such a limit could result in legal action against Austria, however. The EU considers asylum for those needing it as a fundamental right.