At those gates you put the people through a lot of abuse- you treat them as suspects, demand they give up all sorts of rights and property, and expect them to voluntarily become property of the city. And you have quotas so that a lot of people who want to get in are denied entry for no reason other than because of where they were born.
Yes, a lot of people want in bad enough to try to do it your way, but many times that number of people know they haven't got a shot at being allowed in if they do it by the book, so they find other routes in.
And, obviously, really bad guys don't even bother with your silly screening process; they just find a way to sneak in.
So, is it any wonder that by limiting the number of good guys coming in under your "system" you select for a glut of bad guys among the new residents? And then you whine and say you will enclose your town inside a fence, not realizing a fence will change nothing- nothing good, anyway. It will weed out more of the good people and even further select for the bad. When you notice this unfortunate trend, you'll do more of the same- harder and harsher, and be "surprised" when the results get even worse.
The smart thing to do is to make it easy for everyone to make a living honestly (don't allow regulations, licenses, and "taxes"), and make it hard to survive being a thug or parasite. That means don't offer freebies (which are never free) to anyone, and don't do anything to discourage everyone from being adequately armed at all times.
Don't fret over credentials, but only concern yourself with actions. If someone tries to steal from you (or anyone), deal with it. Nothing like "where he was born" or "what hoops he jumped through to get into your town" has any bearing on his actions. None at all.
Until more people accept this truth, silly things like (unconstitutional and unethical) "border control" will keep making America into a worse and worse cage, to the detriment of everyone on both sides of the "border".
And please, don't forget.