From a commentary on Jefferson’s Notes on Virginia:
The United States have already felt the evils of incorporating a large number of foreigners into their national mass by promoting in different classes different predilections in favor of particular foreign nations and antipathies against others it has served very much to divide the community and to distract our councils It has been often likely to compromit the interests of our own country in favor of another The permanent effect of such a policy will be that in times of great public danger there will be always a numerous body of men of whom there may be just grounds of distrust the suspicion alone will weaken the strength of the nation but their force may be actually employed in assisting an invader .
…
To admit foreigners indiscriminately to the rights of citizens the moment they put foot in our country as recommended in the message would be nothing less than to admit the Grecian horse into the citadel of our liberty and sovereignty.
This debate perennially recurs throughout American history. The only thing that’s really changed is that we’ve developed a boundless faith in the ability of education to eradicate all differences between races, religions, and political beliefs. This belief seems to be immune to the accumulation of evidence over centuries that it isn’t quite possible.
What’s also sometimes missed by some libertarian analyses of the history of immigration is that they create a false dichotomy between the international regime of border control that developed in Europe after World War I and the more liberal state of affairs which existed before. Besides technology, one of the major developments was that of mass immigration between newly popular nation-states, most of which were eager to create ethnic and religious uniformity within their borders.
Intellectuals then say that it would be wonderful to go back to the time when borders were more liberal — that is, to the time before the Reformation and the religious wars that followed it. The mostly free travel within Christendom didn’t also include complete freedom for everyone to swap their allegiances. There was some freedom of travel — entirely within the minorities which were not tied to a fief of some kind. Industrialization made it so that the masses were no longer tied to the land, which made mass migration something conceivable even during peacetime.
Owing to the doctrine of equality, it’s become far more difficult to make what would be a reasonable statement of policy in most times and places throughout history — to grant liberality in travel to certain classes of people with certain characteristics (such as brilliant scientists or merchants), and to restrict it more for other classes of people with other characteristics (such as masses of Islamic paupers or Latin-American Communists). This is also what the formal laws in most Western countries call for — but various parties tend to subvert the intentions of those laws with broad cultural support.