An off-duty NYPD captain shot a teenager hanging out near his Staten Island home last night, cops and witnesses said.

A loud bang heard outside his Adrienne Place home caused the captain, a 20-year NYPD veteran whose name was withheld, to leave his house with his gun just minutes before 10 p.m. to see what happened.

It was not immediately clear what sparked two rounds to be fired, one of which hit the 15-year-old boy in the groin.

Police could not say whether the captain fired his gun or if the teen was armed and somehow shot himself.

The teen, identified by a friend as Nikolai Khrapovitski, was with about 20 other teens at Jack’s Pond – a popular teenage hang-out spot that one neighborhood resident said is rampant with drug trafficking.

Khrapovitski and his friends left the pond and were walking on Adrienne Place when one of them kicked a flowerpot into the side of a woman’s house, said Crystal Maialo, whose brother was with the group.

That’s when the captain’s wife came out and yelled at the teens, Maialo said.

“[Nikolai] got smart with the wife,” she said, adding that prompted the captain to come outside.

“They started to argue, yelling and screaming back and forth and then [the captain] shot a couple of times,” Maialo said.

Witnesses told cops the 41-year-old captain could be heard saying: “I’m a police officer. You’re under arrest,” before the shots were fired.

Khrapovitski was taken to Staten Island University North Hospital to be treated for his wound that cops are saying is not life-threatening.