Solidarity with refugees escaping war must not overshadow concerns about human trafficking and the threat from extremists, Hungary's president said Friday.

While "the humanitarian aspects are very important, especially with the coming winter ... we would be making a big political mistake if we neglect the criminal and national security aspects of this migration wave," Janos Ader said.

Ader spoke in the resort town of Balatonfured during a meeting of the so-called Visegrad Group, which also includes Poland, the Czech Republic and Slovakia. The president of Croatia also attended.

Polish President Andrzej Duda emphasized that the European Union's plan to distribute 120,000 refugees on a per-country quota was "not an effective solution" to the migrant crisis, even though Poland voted in favor of the EU scheme.

Duda said the large number of migrants reaching Croatia, Hungary, Italy or Greece was "a problem of the whole European Union and that is how this issue should be approached."

Although the other Visegrad countries have agreed to send police and soldiers to help patrol Hungary's border with Croatia — an unusual action that would see troops from EU countries at the border of a fellow EU member — Croatian President Kolinda Grabar-Kitarovic avoided expressing an opinion.

The foreign troops will help Hungary patrol a fence protected with razor wire it is building on the border with Croatia to control the flow of migrants. A similar fence completed Sept. 15 on the border with Serbia has forced thousands of migrants every day to detour through Croatia to reach Hungary, from where they travel on to Germany and other richer EU destinations.

While the fence on the Croatian border is practically finished, too, Hungary said it would not clamp down until consultations with Germany and Austria, among others.