Police say the officer was walking his dog on the boardwalk at Beach 27th Street around 6:30 p.m. when the group of men approached.
One person in the group appeared to be armed with a gun, and they attempted to rob the officer. The cop reportedly identified himself as a police officer and shots were fired.
Two of the suspects was shot before the group of men fled the scene. The officer was not injured.
Police took three men in custody near the scene, including one who was shot in the chin and arm. Another victim walked into a local hospital and told police he had been shot in the shoulder at the scene of the attempted robbery.
Police also recovered an imitation pistol at the scene. The fake gun was in two pieces when it was recovered.