QUEENS VILLAGE, Queens (PIX11) — Three men were shot in Queens on Sunday night, police said.

There was a crowd near Jamaica Avenue and 214th Place around 8 p.m., authorities said. They’re believed to have been out celebrating the holiday weekend.

A 23-year-old man pulled out a gun and pointed it at the crowd, police said. An off-duty correction officer saw the man and pulled out his own gun. Both were shot in the exchange, but police weren’t sure if the officer was shot by the 23 year old or by someone else. The officer was shot in the left leg and the 23-year-old man was hit at least once in the torso. They were both taken to the hospital by EMS.

Police said a third wounded man went to the hospital himself for treatment. Initially they connected him to the shooting at Jamaica Avenue and 214th Place, but police later said the exact connection wasn’t clear.

The 23-year-old man who initially pulled out a gun has two open prior arrests, Mayor Eric Adams said. One of them involves a robbery with a firearm.

“This is a pattern that continues to play out across the landscape of our city,” he said. “Too many bad people carrying guns and back on our streets without any repercussions for their actions. It is unimaginable that someone waiting sentencing for a gun that he admitted having is now out six months waiting to serve his time for a gun that he had in a robbery.”

Adams visited the wounded correction officer in the hospital. He described him as a hero.

“I believe he saved the lives of other innocent people in this community,” Adams said.

Benny Boscio, president of the union representing correction officers, thanked Adams for visiting the wounded officer. He also urged the public to call police with any tips.

“While the police investigation remains ongoing, one thing is crystal clear, had our officer not exercised his training and made a split second decision, this incident could have cost many innocent people their lives, including his own,” Boscio said. “His actions were nothing short of heroic.”

Submit tips to police by calling Crime Stoppers at 1-800-577-TIPS (8477), visiting crimestoppers.nypdonline.org, downloading the NYPD Crime Stoppers mobile app, or texting 274637 (CRIMES) then entering TIP577. Spanish-speaking callers are asked to dial 1-888-57-PISTA (74782).