Getting Stopped by a Sheriff's Deputy

My family and I just returned from our second trip to Mexico this summer vacation. We drove there the first time (when I was profiled by a Mexican immigration agent), spent several weeks, then returned, bringing my wife's parents for a visit. (They had a nice time). A month later we returned to Mexico and spent a few more weeks. Then my wife and sons and I returned to the U.S.

Last night, on our return trip, we were driving down the highway back in the U.S., not far from our destination. It was night. I was stopped by a policeman (a sheriff's deputy, to be precise) who informed me that the little lights that illuminate my license plate were out. The officer didn't give me a ticket, but he did take my driver's license back to his car and run a check on me, to see if I had an arrest record. I don't, so he let me go with a warning to get those lights fixed.

No big deal, right? But, if a police officer can run a background check on me, an American citizen, what on earth is wrong with a police officer running a background check on somebody who is stopped (for whatever reason) to verify legal residence? After all, that was the essence of Arizona's SB 1070.

Why is it OK to demand ID and run a background check on an American citizen, but it's a horrible injustice to demand ID and run a background check on an illegal alien?