This always seemed like a holder-over from the Franco days and I’m surprised that it took so long to abolish it. I saw this done quite a during rush hour, the police would be standing at the exit of the train station in Sant Cugat and pull out any South American looking person, and arrest them if they didn’t have papers.
Now the police can only demand ID if there is a reasonable suspicion that a crime is being (or has been) committed.
Strange that we had to wait for a right wing government for this piece of common sense. Perhaps they were starting to get annoyed that their cleaning ladies and nannies kept getting arrested.