Authorities say a good Samaritan with a handgun thwarted a savage attack on a police officer in Utah.

Derek Meyer told Salt Lake City Fox affiliate KSTU-TV that he was driving on Main Street in Springville, about 50 miles from Salt Lake City, when he spotted police lights — and a man walloping a police officer.

"He definitely stopped the attack from continuing and becoming much worse," police said of the citizen's actions. "He might have even saved either one of their lives."

Posted by Fox 13 News on Saturday, February 3, 2018

The incident happened about 2 p.m. on Friday, police said. An officer on patrol saw a pair of feet dangling out of a bin for Tabitha’s Way, a food pantry that hosts a clothing recycling program.

(Utah County Sheriff’s Office)

The feet belonged to a man police identified as Paul Douglas Anderson, who climbed out of the bin but refused to take his hands out of his pockets. 

When Anderson finally pulled his hands out, he balled them into fists and struck the officer repeatedly, according to police. The attack fractured the officer’s eye socket and left him with a scratch near his eye, police said.

That’s about the time Meyer saw the scuffle.

“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 told KSTU. Police said Meyer had a permit to carry a concealed weapon. “Outside of that, if I were to use my gun to protect anyone, it would be law enforcement or military personnel.”

He did a U-turn and got out of his car with his gun. He aimed at the man assaulting the officer and ordered him to stop.

Anderson stopped attacking and sprinted away, police said.

Officers from several nearby agencies helped search for Anderson, and a nearby elementary school was placed on lockdown. After half an hour, officers found the suspect hiding beneath a flatbed trailer.

He was taken to jail and charged with assault on a police officer, resisting arrest, theft, burglary and failure to stop at the command of a police officer. Police have not identified the officer involved, who was treated at a hospital and released.

Good Samaritan situations can be unpredictable and do not always go so well for the people intervening, even when the person trying to help is an officer and trained.

In 2016, a Texas man named Isidro Zarate was shot and killed in a Walmart parking lot after he told a man beating his girlfriend “take your hands off her.” The man, whom police identified as Teles Mandan Juarez, pulled a gun and shot Zarate in the neck.

A few months later in Baton Rouge, La., a teenage EMT in training tried to help a woman who had been shot by her boyfriend but was shot and seriously injured by the boyfriend after he returned to the scene. “If you help her, I’m going to kill you,” the man said, according to the teen.

And in June, a black off-duty police officer in St. Louis was shot while coming to the aid of other officers who had exchanged gunfire with teenagers in a stolen car. The shooters: his fellow officers, who didn’t recognize he was a policeman.

But in Utah, police said Meyer’s actions prevented the officer from being more grievously injured — or having to use deadly force.

“Had he not been in the right place at the right time, who knows what would have happened?” Springville Police Cpl. Cory Waters told the news station. “But he definitely stopped the attack from continuing and becoming much worse. He might have even saved either one of their lives. It could have gone really bad, even for the suspect.”

Read more:

A child was taken to a voodoo practitioner for discipline. Police say she will be permanently disfigured.

A chemistry professor got his kids ready for school. Then ICE arrested him on his front lawn.

They met on a dating site and went bowling. It was a setup, police say, and now he’s dead.