Hungary's parliament on Wednesday approved a package of bills that criminalises some help given to illegal immigrants, defying the European Union and human rights groups and narrowing the scope for action by non-governmental organisations (NGOs).

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 U.S. billionaire George Soros and liberal NGOs he backs. Orban accuses Soros of encouraging mass immigration to undermine Europe, a charge Soros denies.

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.

"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.

Oops. Something went wrong.

Thank you,

Immigration has become a major concern for voters across the European Union, 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.

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.

Haaretz.com, the online edition of Haaretz Newspaper in Israel, and analysis from Israel and the Middle East. Haaretz.com provides extensive and in-depth coverage of Israel, the Jewish World and the Middle East, including defense, diplomacy, the Arab-Israeli conflict, the peace process, Israeli politics, Jerusalem affairs, international relations, Iran, Iraq, Syria, Lebanon, the Palestinian Authority, the West Bank and the Gaza Strip, the Israeli business world and Jewish life in Israel and the Diaspora.