In the months after the 9/11 terrorist attacks, New Yorkers venerated the city’s police force, wearing NYPD baseball caps and T-shirts, stopping to hug officers on street corners and delivering food and flowers to their precincts.

A poll five months after the 2001 attacks found that 76 percent of New Yorkers approved of the department’s performance. Even among black New Yorkers — a population with a historically tenuous relationship with cops — the Quinnipiac University survey showed a favorable rating of 56 percent.

But more than a decade later, New York police are the target of fury, much of it triggered by a grand jury’s recent failure to indict an officer in the chokehold death of Eric Garner. The ruling, and ensuing protests, set the stage for an assassin to travel from Maryland to New York to execute two police officers in their patrol car this past Saturday as they were parked outside a housing project in Brooklyn.

“The cops are too aggressive,” Darren Fisher, 25, said two days later, as he stood outside another housing project in a different part of Brooklyn, a Miami Heat baseball cap pulled down over his head. “No matter what, they feel like they’re above the law and nothing ever happens to them.”

That kind of rancor grew out of two decades of aggressive police tactics that began during the administration of Mayor Rudolph W. Giuliani (R) and flourished under his successor, Mayor Michael R. Bloomberg (I).

In particular, fierce opposition grew during Bloomberg’s mayoralty toward the department’s widespread practice of “stop and frisk,” in which officers routinely detained hundreds of thousands of New Yorkers — most of them African American and Latino men.

In 2013, a federal judge described the tactic as a form of racial profiling and ruled that it violated minorities’ constitutional rights. And while the department is phasing out “stop and frisk,” resentment toward the police remains palpable, particularly among blacks and Latinos.

“It’s absolutely right that New Yorkers were deeply grateful and respectful of the police in the post-9/11 era,” said Donna Lieberman, executive director of the New York Civil Liberties Union. “But the Bloomberg administration squandered the good will and support that New Yorkers felt by adopting extremely harsh and excessive policies.”

At the same time, New York’s crime rate has declined to historic levels, including within the city’s toughest neighborhoods. The number of police shootings — fatal and otherwise — remains relatively low for a force of 35,000 officers.

The department has taken pains to diversify its ranks, with the number of minority officers about equaling whites. A dozen years ago, whites accounted for about 60 percent of rank-and-file officers.

While the department’s critics acknowledge a safer city, they also say that police tactics have alienated residents, particularly in poor neighborhoods.

“It doesn’t matter if you diversify if there’s not a relationship fostered between the police and community,” said Onleilove Alston, the interim executive director of Faith in New York, an advocacy organization, who grew up in a Brooklyn housing project.

A video originally posted to Instagram shows police cars in an intersection in Brooklyn, N.Y., on Dec. 20, after two officers were shot and killed. (avasmc/Instagram)

“Our crime rate has gone down, and that’s great,” she said. “But at what cost? It can’t be by any means necessary.”

In the 1990s, Giuliani’s police department cracked down on nuisance offenses such as public drinking and loitering, often using those stops to question and search New Yorkers. Giuliani was a champion of the police, nearly always delivering a full-throated defense when officers’ conduct was questioned.

The aggressive policing proliferated under Bloomberg. In 2011, for example, 685,000 New Yorkers were stopped, nearly 90 percent of whom were not arrested or issued a summons, according to the NYCLU. Nearly 90 percent of those who were stopped were black or Hispanic.

The Rev. David Brawley, pastor at St. Paul Community Baptist Church in Brooklyn, said the level of attention police have shown to East New York, the neighborhood where he is based, has fluctuated markedly.

“You have moments when you’re underpoliced,” he said, referring to the crack epidemic of the 1980s and 1990s. “And then you have moments when you’re overpoliced — stop, question and frisk — and it creates a lot of distrust.

“You can’t overpolice and expect peace and tranquility,” he said. “It’s going to create relational rifts.”

History of protest

New York’s police department has a long history of episodes in which officers’ conduct provoked heated criticism and demonstrations.

What has made the Garner protests distinct is that they have occurred as the country is embroiled in a broad debate over law enforcement and race, propelled by a fatal police shooting in Ferguson, Mo., in August.

“The difference now is it’s a national issue,” said Thomas Reppetto, a police historian and the former head of the Citizens Crime Commission. “You have a shooting in Ferguson — a place we never heard of — and suddenly the president and the attorney general are talking about it.”

Such incidents have occurred periodically for decades in New York, and each time, the reputation of the police eventually recovers.

In 1964, for example, riots broke out in Harlem after an off-duty police officer shot James Powell, 15. A grand jury later cleared the officer. Twenty years later, activists protested a judge’s acquittal of a police officer who shot and killed a mentally disturbed woman during an eviction in the Bronx.

In 1992, the exoneration of an officer in another shooting led to rioting in Washington Heights. But the clamor eventually faded, as it did after police officer Justin Volpe used a broom handle to sodomize Abner Louima at a Brooklyn station house in 1997.

Anti-police protests occurred in 1999 after officers fired 41 shots and killed Amadou Diallo, an unarmed immigrant, in the Bronx. Seven years later, thousands demonstrated after police fired more than 50 shots and killed Sean Bell in Queens.

Despite those episodes, polls conducted regularly since 1997 have found that New Yorkers generally favor the department, though the sentiment is far more pronounced among whites.

In a number of years, blacks were more likely to disapprove of the police. That was not the case as recently as June, however, when 54 percent said they approved of the department’s performance in a Quinnipiac University poll.

Even when police approval rating slips, as it invariably does after highly publicized cases such as Diallo, the department rebounds. Five years after the Diallo shooting, Quinnipiac’s poll found that 69 percent of New Yorkers approved of the police. Among African Americans, the police had a 53 percent favorability rating.

“Every time the cops shoot someone, the police numbers go down,” said Maurice Carroll, director of Quinnipiac’s Polling Institute. In time, he said, those numbers rise and the poll “always shows that the most popular figure in New York is the police commissioner.”

Reppetto said the explanation is as obvious as the dangers of urban life. “People need them,” he said. “They will criticize them, but they don’t want to see them hurt too badly.” Mayor Bill de Blasio (D) is that rare politician who vaulted to office by campaigning against police policies. De Blasio’s opposition to “stop and frisk” not only helped him win the 2013 election, but it also made criticizing the police a part of the city’s daily dialogue.

Campaigning against police

At the same time, de Blasio took steps that alienated officers, whether it was aligning himself with the Rev. Al Sharpton — a longtime police antagonist — or advising his biracial son, Dante, to be careful when dealing with police.

“We’ve never had a mayor who went out of his way to antagonize the police,” said Leonard Levitt, a veteran journalist and author of NYPD Confidential, a weekly blog about the department.

Yet the conflict may be necessary to achieve enduring reform, some critics said. “It takes a long time to change a culture,” said Lieberman of the NYCLU. “The challenge now is to dialogue about a shared vision of a safe community.”

Brawley endorses that broad goal. But he also focuses on more immediate concerns, talking regularly with his local precinct and making officers aware of drug dealing and other problems.

“I’m concerned about what’s going on in the nation,” he said. “There’s a rift between the community of color and law enforcement. What we’re trying to do is make a difference where we can.”