Supply-side immigration
Many countries, including the one I live in (the United States), struggle with a large number of undocumented people living in the country. I do think struggle with is the right word, as such a number of people being unable to have stability or be easily accounted for in programs is a failure of a society to take care of them as it does its citizens. A common argument of populist politicians is for mass deportations, which are usually both impractical and unethical. However, another common argument, and one which tends to be seen as a “common-sense” solution, is improved border security. Stricter border security, if implemented perfectly, would prevent people from coming into the country. This is of course not possible, and because many people are fleeing from danger or circumstances that they will do anything to escape, they will pay anything or do anything to get through the imperfect security. This is likely to create a market of people smugglers, as existed in the USSR and in more recent times in the Mediterranean Sea, charging high fees to anyone who is able to pay them. These smugglers are unlikely to vet those who travel with them, allowing terrorists, people fleeing legitimate crimes, gang members, and other people who hurt people to escape justice and inflict themselves upon your country’s citizenry. Thus, your country must take back control of its border not by decreasing the number who can be allowed through, but by allowing unlimited numbers of immigrants, with fast processing times and effective screenings to quickly return those who have committed crimes or who have come with cruel intent.
Anything else makes it impossible to truly filter.