The new law 'STOP Soros' makes it more difficult for refugees and immigrants to gain asylum in Hungary and threatens people helping asylum seekers with up to a year in prison.
Hungary's parliament on Wednesday approved a package of bills that criminalises help given to illegal immigrants, defying the European Union and human rights groups and narrowing the scope for action by non-governmental organisations.
Under the new law, officially called "STOP Soros," individuals or groups who help migrants not entitled to protection to submit requests for asylum or who help illegal migrants gain status to stay in Hungary will be liable to prison terms.
Prime Minister Viktor Orban has been a vocal critic of German Chancellor Angela Merkel's open-door migrant policy and has led eastern European opposition to EU quotas that aimed to distribute asylum seekers around the bloc.
Orban's right-wing Fidesz party tightened its grip on parliament in an April election fought on a fiercely anti-immigration platform that demonised US billionaire George Soros and the liberal NGOs he backs.
Orban accuses Soros of encouraging mass immigration to undermine Europe, a charge Soros denies.
"The Hungarian people rightfully expects the government to use all means necessary to combat illegal immigration and the activities that aid it," Interior Minister Sandor Pinter wrote in a justification attached to the draft legislation.
"The STOP Soros package of bills serves that goal, making the organisation of illegal immigration a criminal offence. We want to use the bills to stop Hungary from becoming a country of immigrants," he said.
Parliament, where Fidesz has a two-thirds majority, also passed on Wednesday a constitutional amendment to state that an "alien population" cannot be settled in Hungary – a swipe at Brussels over its quota plan.
Hungary's first black lawmaker, Olivio Kocsis-Cake, criticised the new legislation, saying, "they [the government] say that the aim of this law is to prevent illegal migration, but the present laws are suitable to fight against it."
"There are no tightened measures against people smuggling. We say that with regard to the issue of immigration two things are needed: security and humanity. This law gives neither."
Tough stance is vote-winner
Immigration has become a major concern for voters across the EU, helping to propel anti-migrant populists to power in Italy and Austria and threatening to fracture Merkel's three-month-old coalition in Germany.
Orban has drummed up support for his tough measures by exploiting Hungarians' memories of the large numbers of mostly Muslim migrants fleeing conflicts in the Middle East who surged into the country in the summer of 2015.
The vast majority of them moved on to wealthier western European countries, but Orban has branded the migrants a threat to Europe's Christian civilisation and built a border fence along Hungary's southern borders to deter more from coming.
Hungarian statistics show 3,555 refugees living in Hungary, a country of 10 million, as of April. Only 342 people were registered as asylum seekers in the first four months of this year, mostly from the Middle East, and 279 were approved.
The Hungarian Helsinki Committee, a rights group that often represents migrants, said on Wednesday the narrowing definition of who counts as a refugee essentially means nobody entering Hungary by land would be entitled to such treatment.
"Instead of giving protection against persecution, the Hungarian government has decided to join the ranks of the persecutors," Helsinki Committee Co-Chair Marta Pardavi said.
The Orban government expects possible legal action by the European Commission, the EU's executive arm, over the new law.
Law contravenes European rules
Two leading European rights bodies, the Council of Europe and the Organisation for Security and Cooperation in Europe (OSCE), have criticised Hungary's new law as "arbitrary" and vague and said it contravenes European law.
The Venice Commission, an expert body at the Council of Europe, had asked Hungary to refrain from approving the new law until a report it co-authored with the OSCE is published.
Orban has also tightened state control over the media, major business sectors and the courts since taking power in 2010.
In other constitutional changes approved on Wednesday, parliament agreed to set up a new judicial branch for administrative cases that critics say may increase political influence over judges. Another change narrowed the right to free expression and assembly.