NEW YORK (AP) _ The city was within its rights to fire a police officer and two firefighters who rode a parade float featuring mocking stereotypes of blacks, a federal appeals panel said Thursday.

The ruling by the 2nd U.S. Circuit Court of Appeals overturned a lower-court's decision that the men were engaging in free speech and shouldn't have been let go.

``The First Amendment does not require a government employer to sit idly by while its employees insult those they are hired to serve and protect,'' Judge Guido Calabresi wrote in the panel's opinion.

Police officer Joseph Locurto and firefighters Robert Steiner and Jonathan Walters were off duty when they participated in the 1998 Labor Day parade in Broad Channel, a mostly white island community in Queens.

The float they rode was called ``Black to the Future'' and was intended to be a glimpse of life on the island if it ever became more diverse. Participants wore afro wigs and blackface, ate watermelon, pretended to break dance and chanted civil rights slogans.

Near the end of the parade, Walters held the tailgate of a truck and yelled, ``Look what they did to our brother in Texas,'' a reference to the then-recent murder of James Byrd Jr., a black man dragged to death behind a truck by three white men.

The parade was part of a tradition of racist jokes about minorities during the Broad Channel parade _ past years' floats had taken aim at gays, Jews and Asians _ but the episode created a public outcry when television stations obtained videotape footage of the float.

Rudolph Giuliani, then the mayor, vowed that any city officials who participated would be fired.

Giuliani testified during the legal proceedings that his primary concern was that the men had acted unprofessionally.

The officer and firefighters later said they had intended the float to mock white views, not blacks. Their lawyers argued the men were fired because their actions had created political problems for Giuliani, not because they had disrupted their departments.

New York Civil Liberties Union Associate Legal Director Christopher Dunn, who represented Locurto, said he was disappointed in the ruling.

City lawyer Elizabeth I. Freedman, who handled the case on appeal, said in a statement the ``decision properly balances the competing interests of public employees and public employers.''