RIO DE JANEIRO — The team of law-enforcement agents deployed by the mayor to “defend the family” descended on the international event and scoured the grounds for their target: copies of a comic book featuring two young men kissing.

“Books like this need to be packaged in black plastic and sealed,” the mayor of Rio de Janeiro, Marcelo Crivella, said in a video posted on Twitter. The agents, he said, were ordered to seize all copies of the comic book from the city’s International Book Fair because it had “sexual content for minors.”

As it turned out, the police came up empty on Thursday in their two-hour search for kissing comic characters, though they did find “lots of books,” Col. Wolney Dias, who headed the raid, told the newspaper Folha de São Paulo.

The raid also kicked up lots of backlash for the mayor — from festival organizers, publishing houses, comedians and, finally, the Brazilian courts. On Friday, a judge barred Mr. Crivella from further seizure efforts or any attempt to withdraw the festival’s permit, a ruling that was partly overturned on Saturday.