A dispute outside the Brentwood Public Library escalated Friday when one man was shot in what may be a gang-related crime, police said.

With several onlookers nearby, the shooter fired a single bullet into the victim, 22, just after 2 p.m. at the corner of Fourth Street and Third Avenue, said Det. Sgt. Anthony Lavista of the Third Precinct. That corner borders the library’s parking lot.

advertisement | advertise on newsday

The shooter ran off, police said.

The victim’s injury was not life threatening, and he was taken with to Southside Hospital in Bay Shore, police said. He was shot in the abdomen, a law enforcement source said.

Other details were not immediately available as detectives worked into the night to gather information.