FOX NEWS - A Utah police officer who was being attacked on Friday was saved by a passerby with a concealed pistol after the man drove by while the assault was taking place and turned around to help, officials said.

The unidentified police officer confronted the attacker, identified as Paul Douglas Anderson, after spotting feet dangling from a donation bin in Springville, FOX13 Salt Lake City reported on Saturday. Anderson got out of the bin, but refused to remove his hands from his pocket.

The officer ordered Anderson to remove his hands out of his pockets. Anderson eventually took his hands out of his pants’ pockets and began repeatedly punching the officer in the face.

Derek Meyer told FOX13 he was driving by the area when he spotted the police lights and saw Anderson attacking the cop. Meyer turned around, pulled over and pulled out his pistol.

“I carry a gun to protect me and those around me, but primarily I carry a gun to protect my family first and foremost," Meyer, who has a concealed-carry permit, told FOX13. "Outside of that, if I were to use my gun to protect anyone it would be law enforcement or military personnel."

Meyer aimed the pistol at Anderson and yelled at him to stop attacking the officer. Anderson bolted from the scene as responding officers arrived. The attacker, who was found hiding under a flatbed trailer, was arrested and faces several charges, according to FOX13.