A federal appeals court has blocked a judge's ruling that demanded changes to the New York police department's controversial stop-and-frisk policy and ordered she be removed from the case.

In a victory for the outgoing mayor of New York, Michael Bloomberg, the court said Shira Scheindlin's ruling, in which she declared the practice to be unconstitutional, would be stayed pending the outcome of an appeal by the city.

Scheindlin had ruled that the city violated the constitution in the way it carried out its program of stopping and questioning people. She appointed an outside monitor to oversee major changes to the NYPD, and ordered reform to police training and supervision, among a range of other measures.

The ruling on the unconstitutionality of stop-and-frisk stands, but those changes will now be delayed pending the outcome of the city's appeal, and Scheindlin will no longer be involved in the case. Jonathan Moore, a lead attorney in the federal lawsuit challenging the department's stop-and-frisk practices, said was "unprecedented".

"Basically, this court is saying to the citizens of New York, who have followed this case and who were very uplifted by the fact that a federal judge stood up to protect the rights of all citizens of the city of New York … this is the panel of the second circuit saying: 'Drop dead, New York'," Moore said.

"It's embarrassing, it's unprecedented and it's a travesty of justice that this panel did this."

Sheindlin ruled in August that police officers violated the civil rights of tens of thousands of people by wrongly targeting black and Hispanic men. In addition to appointing an outside monitor to oversee police, she ordered a pilot program to test body-worn cameras in some precincts where most stops occur.

The city asked the second circuit for a stay on the ruling, and the remedy measures. But in Thursday's ruling, the second circuit went significantly beyond the city's demands, ordering that the case be reassigned to another judge because Scheindlin had violated the judicial code of conduct by compromising the need for impartiality. The court said it had been influenced in part by a series of media interviews and public statements given by Scheindlin, in which she responded to criticism.

The court cited comments made by Scheindlin in articles in the New York Times, the New Yorker and elsewhere responding to public criticism of her by Bloomberg and police commissioner Ray Kelly.

Campaigners against stop-and-frisk say Scheindlin was the victim of a whispering campaign orchestrated by the city. Throughout the trial, the mayor and the police commissioner attacked Scheindlin in media interviews and speeches, but declined to testify in court.

The pair criticised Scheindlin as being "in the corner" of civil liberties activists campaigning against stop-and-frisk while an internal report by Bloomberg's office, shared with the New York Daily News in May, sought to portray the judge as biased against law enforcement.

Moore criticised the second circuit for removing Scheindlin from the case.

"To not only issue a stay, but to remove this judge who had been working on this case for so many years and worked very hard and conscientiously and provided everybody a fair trial … to remove her, based upon the things that the court said … I never heard of such a thing."

Moore said he and his team would file a motion for re-hearing "en banc" – a legal procedure requesting all the active judges of the second circuit to weigh in on the case. He said the motion would be filed "as soon as we can".

Bloomberg's tenure as mayor ends in December, with New York City due to vote for its next leader on Tuesday. Polls shows that Democrat Bill de Blasio, an outspoken critic of stop-and-frisk, is the clear favourite.

De Blasio has made the policy a central issue of his campaign, with his mixed-race son featuring prominently in his campaign adverts praising the Democratic nominee's stance on stop-and-frisk.