Hungary on Tuesday criticized legal action by the European Union to make the country comply with EU asylum rules as "unacceptable" and an attack against those who protect Europe.
The European Commission, the EU's executive arm, last week referred Budapest to the European Court of Justice (ECJ), the bloc's top tribunal, for "non-compliance" with EU legislation.
It was after Hungary passed the so-called "Stop Soros" law last month, named after liberal US billionaire George Soros, who is accused by Prime Minister Viktor Orban's government of orchestrating migration to Europe.
The law includes a punishment of up to a year in prison for anyone assisting someone who enters Hungary illegally.
In the first public comments by the government since the EU action, minister Gergely Gulyas said it was "unacceptable" for Brussels to challenge the law.
"We continue to see that those who protect Europe are persecuted, while those who invite migrants are celebrated," Gulyas told a press conference, criticizing the commission for not reflecting EU members' views.
The row is the latest clash between the commission and Orban's government, who won a third consecutive term in April on a fiercely anti-migration platform.
Orban regularly accuses German Chancellor Angela Merkel of having encouraged the 2015 influx of migrants by declaring them welcome.
Orban said in Montenegro on Tuesday during a state visit that Hungary was ready to help the small eastern European country "defend its territory" against migrants.
"Europe continues to make serious mistakes. (It) does not want to understand and acknowledge that it needs to refrain from moves that may be interpreted as an invitation in Africa or the Middle East... That is why people drown in the sea and remain jammed on migration routes," he told reporters.
Hungary has two months to respond to the European Commission's concerns.
In other action, the commission has said it will take Hungary to the ECJ for failing to resolve complaints made in December 2015 that it held asylum seekers for too long in transit centers and did not treat them properly.
The commission added that irregular migrants were escorted back across the border even if they wanted to apply for asylum -- a violation of EU rules.
Hungary announced last week that it was withdrawing from a UN pact on migration, saying that the global deal encourages movements of people which are "dangerous for the world."