There’s also the matter of birthright citizenship.
I read a while back that a lot of Algerians and others were brought into France as workers. And not given citizenship. Their children born in France didn’t get citizenship. And so you get a whole generation - and then another - who aren’t even second class citizens. They know it, they resent it, and of course it leads to unrest and worse.
Almost all of the western hemisphere has birthright citizenship. Even when immigrants don’t blend in well, their children - with automatic citizenship - do.