A York City man escaped injury Thursday night when someone shot at him, apparently because he was defending the police.

Jameel Murray, 22, of West King Street, told officers he was confronted by a group of people, one of whom fired at him as he walked away, York City Police said.

It happened about 7:40 p.m. near the corner of South Belvidere Avenue and West Poplar Street.

An officer in the area heard the gunfire and, while investigating, was flagged down by Murray, police said.

Murray told the officer he was approached by about seven people, and one said, "You keep calling the cops on us and we don't do the cop thing," according to police.

Murray said he responded by saying, "The cops are the only ones who help us," police said.

Murray then turned and started walking away, at which point he heard someone shooting.