Superior Court Judge Rolf M. Treu on Wednesday rejected arguments that the city's policy - under which most suspects are not asked about their immigration status - conflicted with federal and state law.
Los Angeles police work in communities with large numbers of illegal immigrants, and generally don't inquire about immigration status because it could discourage undocumented people from helping officers and reporting crimes.
Police Chief William Bratton said the judge preserved "an essential crime-fighting tool for us." Mayor Antonio Villaraigosa said the ruling recognized that "turning local police into federal immigration agents would lead to fewer arrests, prosecutions and convictions."
Under a 1979 order formally known as Special Order 40, LAPD officers do not ask about immigration status while interviewing victims, witnesses and suspects, and do not arrest people based on immigration status.
Officers alert immigration officials if a suspect is a gang member who has been previously deported, or if a suspect is arrested for a felony or multiple misdemeanors.
The lawsuit filed in April 2007 was brought on behalf of unidentified police officers who said they were afraid to speak out, but who depicted a revolving door legal system in which the same illegal immigrants are repeatedly arrested instead of deported.
The lawsuit sought to require officers to inform federal immigration officials when illegal immigrants are arrested on drug charges.
The judge referred to the national debate over immigration, but said he sought to "avoid considering the political aspects of the case and focus only on the legal ones."
Paul Orfanedes, a lawyer for Harold P. Sturgeon, who brought the case, said the judge sidelined tens of thousands of law enforcers who could help immigration authorities.
Police "are being gagged. It's don't ask, don't tell as regards to legal status," Orfanedes said.
The ruling granted motions for summary judgment in favor of the Police Department and the American Civil Liberties Union, which intervened in the case.
Hector Villagra, an ACLU attorney, said the decision affirmed that the federal government, not local law enforcement, is responsible for carrying out immigration law.
By asking that Special Order 40 be thrown out, Villagra said, plaintiffs are "asking for carte blanche to engage in racial profiling," he said.