(CNN) -- An Arizona trooper who had been shot and was being beaten by a man with a pistol was saved Thursday by a motorist who killed his attacker, authorities said.

The man who came upon the scene warned the suspect to stop striking the officer, but the man continued, said Capt. Damon Cecil, a spokesman for the Arizona Department of Public Safety, said.

The good Samaritan got a gun from his car and shot the suspect, who died at the scene.

The trooper, a 27-year veteran, was shot in the chest and shoulder. He is in serious and stable condition, Cecil said.

Col. Frank Milstead, director of the public safety department, said he would like to thank the man who stepped in. "I don't know that my trooper would be alive today without his assistance," he said, according to CNN affiliate KNXV.

Unusual circumstances

Public safety spokesman Bart Graves said the incident began with the trooper responding to report of shots fired from the median of an unlit, rural section of Interstate 10 near Tonopah. The officer came across a vehicle that had rolled over and got out to investigate. While the trooper was setting flares, the suspect shot him.

It was not clear where the suspect was when the officer pulled up.

Milstead said at some point the suspect started beating the trooper, who was unable to use his right arm to defend himself. That's when the motorist pulled up and opened fire on the suspect.

"It's fairly rare" that citizens who come to the aid of law enforcement officers use deadly force, Cecil said.

Another motorist who stopped used the trooper's portable radio to call in the shooting.

The conversation between that driver and the dispatcher was very businesslike, Cecil said.

"Hello. Officer down, officer down outside Tonopah. Come in, please," the man says, according to audio archived on Broadcastify, which streams radio communications between emergency responders. "He's in real bad shape. Please send air support, helicopter, please."

He tells the dispatcher there are two other people who are down in an "unknown condition."

Cecil praised the motorists who stopped to help, saying, "They were calm, determined."

A woman who was ejected from the vehicle died at a hospital, authorities said.

Authorities didn't release the names of the people involved in the incident, which occurred after 4 a.m. near mile marker 89, west of Tonopah. That city is about 50 miles west of Phoenix.

CNN's Keith Allen contributed to this report.

The-CNN-Wire

™ & © 2017 Cable News Network, Inc., a Time Warner Company. All rights reserved.