Remember Rome.
I could write a book on this but this is more salient than a lot of people realize.
During the decline one of the major complaints was that the slaves (illegal immigrants) took the citizens jobs. You even had public works projects declaring they would only hire non slaves. This drove citizens to be on the dole (corn laws) which is essentially public welfare
This was complicated by the fact that the military budget had to grow and grow as the borders extended