It has been challenged in the courts since 2006 with opponents calling it a "don't ask, don't tell policy for undocumented aliens."
The issue came to a head recently when Jamiel Shaw, a Los Angeles area high school football star, was killed, allegedly by an illegal immigrant who was a suspected gang member just released from jail.
The court's ruling does give police officers some leeway in allowing them to voluntarily communicate information to federal authorities. However, officers cannot initiate action with the sole objective of discovering someone's immigration status.
City News Service and the Associated Press contributed to this report.