NEW YORK — A community festival was coming to a close when gunfire erupted in a Brooklyn neighborhood, leaving one man dead, another person in critical condition and 10 others wounded, authorities said Sunday as they searched for two shooters they believe were involved.

NYPD Commissioner James O’Neill said the shooting late Saturday in the borough’s Brownsville section “was a tragic end to a wonderful weekend” where thousands of people had come to take part in the annual Old Timers Event, which he said had been held since 1963.

The crowd at the celebration, which features musical performances from former residents and current local talent, was dispersing when gunshots rang out from a playground area in the park where it was taking place, officials said.

Twelve people were hit — seven men and five women between the ages of 21 and 55. A 38-year-old man died from a bullet wound to the head. His name was not immediately released. One of the injured was critical.

Six of the wounded had been released from the hospital by midday Sunday, O’Neill said.

No arrests have yet been made, and authorities asked anyone with information or cellphone video to come forward. One gun was recovered.

“There were a lot of people just chilling and having a good time,” Kaseem Collins, 19, told the Daily News. Then, when shots rang out, “we all started running,” he said. “I ran as fast as I could away from everyone. I thought I was going to get shot.”

“I heard shots, and I saw a stampede running toward me,” Diamond Perez, 38, told the newspaper.

A 2010 newsletter from the parks department described the Old Timers Event as a celebration of former members of the Brownsville Recreation Center “who went on to success and fame in sports and other endeavors.” It said the event has grown over the years to include concerts and other things.

“One of the worst experiences of my life,” City Council member Alicka Amprey-Samuel tweeted. “How does such a beautiful and peaceful event become overshadowed by tragedy in seconds?”

“It was chaos,” Gary Miller, a 60-year-old vendor at the event, told the New York Post. “Shots rang out, and the crowd was already dispersing, and you heard about 9 to 11 shots and everyone was running and scattering for cover.”

Videos posted on social media showed police clearing large groups of people out of the area around the recreation center. Photos from local news outlets showed several people taken away on stretchers, including some with what appeared to be minor wounds.

By midmorning, the area was cordoned off with police tape.

Brownsville is an east Brooklyn neighborhood that’s continued to struggle with gun violence, even as New York streets become safer than they have been in decades.

State Sen. Roxanne J. Persaud added the hashtags “#StopTheViolence” and “#PutDownTheGuns” to her tweets expressing frustration with the shooting, which she called “unacceptable” and “cowardly.”

“Our community mourns again. We should be able to have fun in open spaces without fear of violence,” tweeted Persaud, whose district includes Brownsville. “Respect your community. We are better than the violence.”