It might happen without foreigners too, but it's so easy to blame them. Besides every country has foreigners from other countries. Don't they realize U.S. is full of Mexicans, for instance?
I went to Mexico 20 years ago. I thought I'd try to find work for a few months. Even though I found a job other people prevented me from working. They were orders of magnitude more aggressive against me than I remembered Americans were in California against illegal aliens from Mexico at that time.
Imagine that! Impoverished citizens of a third-world nation are more aggressive against wealthy foreigners, than are wealthy first-worlders against the pittance-wage illegal immigrants that they hire to harvest their crops! Inconceivable!