Deputy Terry Ely was stopped behind Ralph Valletta's cab at a red light in Reading, Pennsylvania, when he noticed something amiss, according to local news outlet WFMZ.
"It was a red light," Ely told WFMZ. "It then cycled through to green. The car did not move, and it went back to red again. At that point, I just wanted to make sure everything was okay in the car."
In the vehicle – as caught on the dash camera – the passenger pointed a gun at Valletta through the cab's front vestibule.
"Give me all your money, man! Give me everything you got," the suspect – who had his hood pulled tight and wore a mask – demanded. "I need it all right now if you don't want to die," he said.
After activating his cruiser's lights, the sheriff's deputy approached the car and heard the driver say, "just please don't shoot me" – prompting him to spring into action.
Ely drew his firearm and ordered the suspect out of the vehicle and down on the ground while calling for backup.
"Oh my God, you're a lifesaver," Valletta told the officer on video.
The suspect has been identified as Victor Herrea, 18. He was arrested and jailed on charges that include robbery and making terroristic threats, according to the AP. His bail was set at $100,000.
The weapon was later determined to be a pellet gun, and Valletta was not injured during the incident, reported ABC7.
"I almost had a heart attack in the car. My heart was beating," Valletta, who drives for Reading Metro Taxi, told WFMZ. "You know, when that gun's pointed at your head, your body is doing things."
Added deputy Ely of Valletta, "He immediately stood up, ran over to me and gave me a hug and said, 'Thank you. You're a godsend.' "