In this case, the city had argued in court that the mask law was intended not to stifle unpopular speech but to enable the Police Department to do its job at rallies where the potential for violence existed. In explaining the reason for the city's appeal today, Michael D. Hess, New York City's Corporation Counsel, cited the violence seen at Klan rallies that Mr. Berry testified about in court.

''When we as a city are faced with this type of violence,'' Mr. Hess said, it was important for the police ''that the identity of every individual be known. We want to discourage violence, and one way to discourage violence is to know who you're faced with,'' he said. ''The court, we feel, erred in saying that masks can be used because that takes away from the Police Department's ability to identify people and hold them responsible for their actions if there is violence.''

But the judges, Harold Baer Jr. and Alvin K. Hellerstein, while sympathizing with the department's predicament, said there had been no testimony suggesting that the Klan members were likely to engage in violence themselves. Citing Supreme Court decisions that protect certain forms of conduct or expression under the First Amendment, the judges said they agreed with the Klan's position that the masks afforded the group's members anonymity and protection from potential retaliation in their home communities or jobs.

''Masks have a -- perhaps tortured is a good word to use -- history in the United States,'' Judge Hellerstein said, ''creating fear, and fear of physical violence on the part of one group of our citizens, and creating the message of hate and spite and everything that America does not stand for.'' But, he said, masks also reflect ''a fear of people who express themselves in various parts of our society, including the society of New York, that they may be subject to harm, both physical and economic, if they are unmasked and their identities are known.''

Judge Baer quoted Justice Oliver Wendell Holmes, saying, ''I think that we should be eternally vigilant against attempts to check the expression of opinions that we loathe and believe to be fraught with death, unless they so imminently threaten immediate interference with the lawful and pressing purposes of the law that an immediate check is required to save the country.''

The judges' decision could be upheld today by the appeals court, or overturned, which could make Klan members subject to arrest if they held the rally in masks.

Norman Siegel, executive director of the New York Civil Liberties Union, which is representing the Klan, said his clients planned to keep trying to overturn the mask law.