Instead, at least two gunmen opened fire as the neighborhood block party in Brownsville was winding down late Saturday, killing a 38-year-old man and wounding 11 people in the crossfire, authorities said.

Mayor Bill de Blasio, in a news conference Sunday morning at the scene, lamented the violence at an event that had been held “successfully and peacefully” for decades and “had been an example of everything good about Brownsville.”

More than 100 police officers were on duty at the party when the shots rang out minutes before 11 p.m. near the intersection of Christopher and Hegeman avenues, where about 2,000 people had gathered in and near a playground, police said.

The man who died was shot in the head as he waited for an Uber to take him home after Old Timers Day, which has endured without violence since its inception in 1963, according to police and Assemblywoman Latrice M. Walker, a native of Brownsville who left the party less than an hour before the shooting.

The shooting quickly eclipsed what was becoming a success story in Brownsville, a neighborhood scarred by decades of official neglect, deep poverty and street violence. Shootings had been declining this year in the neighborhood despite a slight rise in gun violence across the city.

Walker said the shooting death was a painful turn of events on an already somber occasion for her family. Her brother, she said, was shot and killed 32 years ago to the day. The victim of Sunday’s shooting, she added, was the second of his siblings to die by gun violence.

“I’m hurt,” Walker said. “I’m mourning.”

Police did not say whether any of the victims — who ranged in age from 21 to 55 — had been the targets of the gunfire, or if the gunmen had indiscriminately strafed the crowd with bullets.

One of the most seriously injured partygoers remained in critical condition Sunday at an area hospital. Other victims remained hospitalized in serious condition, and several had been treated for their injuries and released, the police said.

Police said detectives were still searching for the gunmen and investigating whether the motive for the violence stemmed from a gang dispute. A gun was found at the scene, but investigators had not determined if it was used in the shooting, police officials said.

Police Commissioner James P. O’Neill asked people who had been in the playground to send any videos from before, during or after the shooting.

“Please, please turn that over to us,” he said. “It would be very helpful.”

Videos circulating online after the mayhem show police trying to gain control of a chaotic and sprawling crime scene full of residents and strewn with food containers, bottles, chairs and tables. The bloodshed turned police cars into ambulances as officers helped rush victims to the hospital, police and fire officials said.

The shooting disrupted what in many New York City neighborhoods is an annual summer ritual. Even in some of the city’s grittiest neighborhoods, warm-weather block parties draw neighbors outside for conversation, food and drinks, games and music. Saturday’s Old Timers Day block party capped more than a week of festivities that included musical performances, a fashion and talent show and a street festival.

Shootings in Brownsville have declined from last year, and fewer people have been struck by gunfire, according to police data through July 21, the most recent available.

Brownsville’s decline in shootings has defied a rise in violence in other parts of northern Brooklyn that the police have said has contributed to the citywide uptick in shootings. Overall in New York, there have been more shootings and slightly more people struck by gunfire this year compared with the same period in 2018, according to police data.

Brownsville drew renewed attention last week after video surfaced of a man there pouring a pail of water over a police officer’s head. The video was one of at least four that escalated a public debate about how restrained officers should be when they are humiliated or taunted by the public.

Eric Adams, the Brooklyn borough president, said Saturday night’s shooting stemmed from the city’s failure to support anti-violence programs that work in crevices of the city where violence remains stubbornly high. He called for more funding for programs that have been proven to defuse tension before it escalates.

The city spends $36 million on such programs, but Adams said that is barely half what is needed. Additionally, he said the city is often late to pay groups that do the work, leaving them unable to pay staff members who risk their lives walking into combustible situations.

De Blasio, at the news conference, vowed to increase funding and interagency support for the city’s Cure Violence programs, describing the goal of getting guns off the streets as “our most essential mission.”

Local officials said they had complained for years that the city was not doing enough to target its pockets where violence remains persistently high. Some of the anti-violence programs still encounter opposition from hospitals and city agencies, but resistance is most acute from the police, said Adams, a retired New York Police Department captain and the co-founder of 100 Blacks in Law Enforcement Who Care.

De Blasio has embraced a neighborhood policing program designed by O’Neill, and the two frequently speak of crime-fighting as a two-way process that requires the police and civilians to work together. But Adams said that in some places, an antiquated mindset persists among some officers.

“Those terms about community and police coming together, those are bumper stickers and slogans,” he said, adding it is “not a reality in all communities.”

This article originally appeared in The New York Times.