If you provide real social security for anyone in the country and don't limit immigration at all, you attract people who aren't willing or able to work and want to live off social security.
You won't, cause there isn't a single country in the world which doesn't limit immigration, and also not a single country in the world which provides solid social security to all its inhabitants (and not only its citizens).
It was just a hypothetical answer to your hypothetical question, and for the record, I'm very much in favor of lenient immigration laws.