NEW YORK - The nation's largest police department learned the hard way that there are legions online devoted to short-circuiting even the best-intentioned public-relations campaign - in this case, the NYPD's Twitter invitation to people to post feel-good photos of themselves posing with New York's Finest.

What #myNYPD got instead was a montage of hundreds of news images of baton-wielding cops arresting protesters, pulling suspects by the hair, and taking down a bloodied 84-year-old for jaywalking.

It was a fail of epic proportions, with the hashtag among the most-trafficked in the world, creating a public-relations nightmare for a new NYPD leadership intent on creating a more community-friendly force.

"We've seen instances before where a hashtag can become a bash-tag," said Glen Gilmore, who teaches social-media marketing at Rutgers University. "When you're in the social space, it's tough to predict what's going to happen."

A similar meltdown came in 2012 when McDonald's launched its #McDStories campaign. Sample response: "I walked into a McDonald's and could smell the Type II diabetes."

The misfire comes at a time when new Police Commissioner William Bratton is trying to rebrand the department to counter criticism that it has been trampling on civil rights. Last week, it disbanded an intelligence unit that spied on Muslim areas, and it has promised reforms to the tactic known as stop and frisk.

He conceded the campaign might not have been fully thought through.

"Was that particular reaction from the some of the police adversaries anticipated? To be quite frank, it was not," he said. "But at the same time it's not going to cause us to change any of our efforts to be very active on social media."

The #myNYPD traffic was holding steady Wednesday, but the dialogue had shifted from mockery to an analysis of what went wrong, including the tweet "Social Media 101: Be careful what you ask for."