Hungarian Prime Minister Viktor Orban says there is a clear link between illegal immigrants arriving in Europe and a rising threat of terrorism.
Speaking at a cultural festival in the Romanian town of Baile Tusnad on July 25, Orban justified his conservative government's anti-immigration stance.
"It is obvious that we simply cannot filter out hostile terrorists from this enormous crowd," he said.
Hungary is building a fence along its border with Serbia to stem the flow of illegal immigrants. The project has been criticized by Serbia and the United Nations' refugee agency.
Once they arrive in Hungary, which is in the EU's passport-free Schengen zone, they can travel freely within the EU.
Over 90,000 migrants have entered Hungary this year. Most refugees request asylum but leave for other destinations like Germany or Sweden before their cases are settled.
Most of the migrants, including children who hike for weeks trying to cross Macedonia, Serbia, and Hungary, come from the war-torn countries of Afghanistan, Iraq, and Syria.