Opponents of the New York Police Department's controversial stop-and-frisk program scored a major victory in court Wednesday, after a federal judge granted class-action status to a lawsuit alleging that the department subjects millions of city dwellers to racially biased illegal searches.

In a scathing 57-page decision, Judge Shira A. Schiendlin said there was "overwhelming evidence" that the stop-and-frisk program is being directed from the highest levels of the police department and has been responsible for thousands of unlawful stops.

In its arguments seeking to dismiss the lawsuit, Schiendlin wrote, the police department "displays a deeply troubling apathy towards New Yorkers most fundamental constitutional rights."

Schiendlin's ruling is a serious blow to the police department as well as Mayor Michael Bloomberg's administration, which has strongly backed Police Commissioner Ray Kelly's handling of the program, legal experts said.

"It should be a wake-up call," said Eugene O'Donnell, a professor at the John Jay College of Criminal Justice. "It's a strong rebuke to the police department and the city."

The ruling clears the way for thousands of New Yorkers who may have been victimized by illegal searches to join the suit, which seeks an injunction forcing the police department to change its policy. The city has 30 days to appeal the ruling.

Millions of New Yorkers have been stopped under the rapidly expanding stop and frisk program in the past decade, including more than 600,000 in 2011. New figures released last week show the police department on track to detain and search 730,000 people in 2012, according to the New York Civil Liberties Union. By comparison, the NYPD stopped just 97,000 people under the program in 2002.

Nearly 90 percent of those stopped in 2011 were black or Latino. There were more stops of black men aged 14 to 24 than there are members of that demographic in the city.

In a press conference at City Hall, Bloomberg said he had not read the decision and would not comment on it.

"We respectfully disagree with the decision and are reviewing our legal options," Connie Pankratz, a spokeswoman for the city's legal department, said in an email.

Darius Charney, an attorney with the Center for Constitutional Rights, which filed the suit against the city, said the judge's ruling included factual findings in favor of its contention that police department policy -- not the actions of a few rogue officers -- had led to widespread illegal searches. On appeal, the city would be unable to challenge those facts, he said.

"We believe that we've developed a very strong factual record that these illegal tactics are used city-wide," Charney said. "That's established. That's not going to be reopened or changed."

New York City elected officials opposed to stop and frisk quickly pounced on the ruling, calling it yet another indication that Bloomberg and the police department leadership were out of touch with the concerns of ordinary New Yorkers.

"It is time for the city to face the damage done by this divisive policy," said Manhattan Borough President Scott Stringer, who is expected to run for mayor in 2013.

With Bloomberg set to leave office next year, stop and frisk has emerged as a potentially key issue in the race to replace him. The issue could remain on the front burner if an appeal of Schienlin's decision is rejected and the case is sent to trial.

A recent attack by Howard Wolfson, New York City's deputy mayor, on Bill De Blaisio, the city's public advocate and another expected mayoral candidate, suggests that Bloomberg has no intention of backing down on stop and frisk, however.

De Blasio has been sharply critical of stop and frisk, calling the policy "broken" in a recent speech.

"He's turning a blind eye and doesn't even acknowledge that there's a concern around the city," De Blasio said of the mayor's approach. "It proves how out of touch he is."

In response, Wolfson said De Blasio was "nostalgic for the days when the ACLU set crime policy" in the city.

"Make no mistake, we will not continue to be the safest city in America if Mr. De Blasio has his way," Wolfson said.