On Tuesday, our city reeled as four senseless shootings claimed five lives in just 24 hours. The fatalities, which spanned from Jamaica, Queens to Coney Island, Brooklyn, were a reminder of how our gains in public safety can be reversed if we’re not vigilant.

One of the people killed during this spree, a 28-year-old Queens resident named Arsenio Gravesande, summed up the challenges that law enforcement officials encounter in going after chronic gun violence with three words.

When asked by the NYPD to identify the person who shot him, he said, “F- -k you, son!” It was one of the last things he uttered before dying from a gunshot wound to his hip.

The refusal to snitch out of a pathological hatred for police is nothing new. We’re all familiar with the phrase, “Snitches get stitches,” which is common street code.

But as New York City contends with a rise in shootings in some communities, we simply cannot afford to let this mindset hamper law enforcement’s efforts to make our neighborhoods safer.

I served in the NYPD for 22 years, and I can vividly recall trying to extract information from people who refused to cooperate. Not only did it make our jobs harder, it often hurt those who were abiding by the street code the most.

It’s no secret that gun violence impacts young men of color, like Mr. Gravesande, the most. Data from the US Bureau of Justice Statistics survey confirm that, from 1993 to 2010, the most likely victims of firearm-related homicide were males, blacks and people ages 18 to 24. And yet, too many young men of color still cling to a “Snitches get stitches” mentality that leaves them more vulnerable.

One case from my days on the force illustrates this dynamic. During one midnight tour while I served as the platoon commander in the 88th Precinct, we received reports of a shooting. The young man who was shot knew the perpetrator, but he refused to tell us who shot him, and the gun and shooter remained on the streets. A few days later, the victim’s younger brother was also shot, the same tragic, yet preventable, fate.

We must not and will not allow shooters and criminals to find safe haven in the communities they victimize. Upholding a code of silence only serves to promote violence.

To contain the ripple effect of shootings spreading throughout our city, communities have to partner with law enforcement and vice versa.

It’s time to reframe this conversation. Someone who decides to turn in a violent criminal isn’t a snitch; they’re a hero. Mr. Gravesande unfortunately chose to be silent with his dying breaths. If we want to prevent future killings like his, we’ll have to speak up and be heroic.

Eric Adams, a Democrat, is the Brooklyn borough president.