A federal judge ruled that the contentious NYPD tactic known as stop-and-frisk violates constitutional rights, appointing a monitor to oversee reforms and ordering the department to test body cameras for officers.

U.S. District Court Judge Shira Scheindlin wrote in the opinion released Monday that she was not ordering an end to the practice, but was seeking to provide remedies "to ensure that the practice is carried out in a manner that protects the rights and liberties of all New Yorkers, while still providing much-needed police protection."

She said the practice violates the Fourth Amendment, the right to be secure against unreasonable search and seizure, and the 14th Amendment, which forbids the denial of life, liberty or property, without due process.

Mayor Bloomberg said the city would appeal, and accused the judge of ignoring "the real-world realities of crime." He said the judge's orders, if implemented, would make New York "a more dangerous place."

"This is a very dangerous decision made by a judge that I think just does not understand how policing works," he said.

The judge said she was not imposing any immediate changes to stop-and-frisk because it would be "unwise and impractical" to do so without input from the monitor. Instead, change will come gradually, after the monitor begins work.

One short-term order she did issue was to require the NYPD to test "body-worn cameras" for officers. She said the practice has potential, and said the department must begin a pilot program with cameras on patrol officers in one precinct per borough. The city must fund the project, she said.

Bloomberg said cameras on officers "is not a solution to the problem."

In addressing the NYPD's reasons for stops, Scheindlin said an officer must have reasonable suspicion "that the person stopped has committed, is committing or is about to commit a crime." "Furtive movements," a reason cited in some NYPD stops, is not sufficient, nor is simply being present in a "high crime area," the judge wrote.

She also said a person cannot be stopped just for matching a vague description "such as young black male 18 to 24."

Further, she said, people can't be targeted for stops because their racial group may have higher instances of crime. Race, she said, can only be considered when the stop is based on a specific description.

"Officers must cease the targeting of young black and Hispanic males for stops based on the appearance of these groups in crime complaints," she said.

The NAACP said Monday that the ruling was "a groundbreaking victory."

"This is a great day for justice and equality in this city," said New York NAACP President Hazel Dukes.

The judge also addressed what would justify proceeding from a stop to a frisk, declaring that the officer has to suspect the person may be "armed and dangerous." A frisk, she said, is not to discover evidence of a crime, but to uncover potential weapons that could injure police.

Scheindlin said the monitor, former city corporation counsel Peter Zimroth, will primarily be charged with reforming the NYPD's use of the tactic, which "will inevitably touch on issues of training, supervision, monitoring and discipline."

The judge said she was not calling for the NYPD to abandon "proactive policing and return to an earlier era of less effective police practices," but was instead aiming for a fair approach to police stops that would foster trust in the department and promote its mission of fighting crime.

The monitor will develop reforms "as soon as practicable," and will report to the court for approval. He will then be responsible, the judge said, to conduct compliance and progress reviews, and will issue public reports every six months. The city will be responsible for the costs of the monitor, his staff and any experts he uses.

In the meantime, a yet-to-be-appointed facilitator will gather community input, including from town hall meetings in each borough, to hear from "those who are most affected by the NYPD's use of stop-and-frisk," the judge said.

Scheindlin said she would have preferred to work with the city to develop remedies, but that the Bloomberg administration had declined to participate in such a conversation.

The Patrolmen's Benevolent Association said in a statement that the ruling was unnecessarily complex and failed to address the problem.

"Monitors, facilitators and public hearings, which will cost this city millions of dollars, will do nothing more than make the toughest policing job in the world even more difficult and dangerous," said PBA President Patrick Lynch.

The ruling came after more than nine weeks of testimony from men who said they were wrongly stopped because of their race, and police officials who believe the nation's largest force operates with integrity.

More than 5 million stops have been made in New York in the past decade, mostly of black and Hispanic men. Police must have reasonable suspicion to stop someone, a standard lower than probable cause needed to justify an arrest. Only about 10 percent result in arrests.