A man who shot and wounded an Arizona state trooper Thursday along a remote highway and then started slamming the helpless officer's head into the pavement as the two struggled was shot to death by passing driver, authorities said.

Trooper Edward Andersson, a 27-year veteran of the Department of Public Safety, was shot in the right shoulder and chest in what authorities called an ambush and was in serious but stable condition after surgery at a Goodyear hospital.

"My trooper would not be alive without his assistance," DPS Director Frank Milstead said of the driver who stopped.

Arizona has a "defense of third person" law that allows someone to use deadly force against another who is threatening or injuring a third person. It was not unusual that the passing driver was armed in this gun-friendly state with loose regulations.

"Arizona was open-carry before it was a state," Charles Heller, co-founder of guns-rights group the Arizona Citizens Defense League, said of laws allowing people to carry firearms in public. "If you see a guy walking down the street in Tucson, Arizona, with a gun on, you don't think much of it. It's natural."

The drama unfolded at an early-morning rollover wreck on Interstate 10 in the desert west of Phoenix that ejected and killed a woman. Authorities believe the man who shot Andersson was driving the car that crashed.

Officials said they were trying to determine exactly what happened and that the investigation faced major hurdles with Andersson seriously injured and two others dead. Their identities were not immediately released.

A separate driver reported gunfire and Andersson was responding to that call when he spotted the wreck and stopped, Milstead and DPS Capt. Damon Cecil said.

Andersson was putting out flares when the suspect opened fire and then physically attacked the wounded trooper, Milstead said. Both Milstead and Cecil said was ambushed.

The man was on top of the officer and "getting the better of him," slamming Andersson's head against the pavement, Milstead said. That's when the passing driver showed up and asked if the trooper needed help.

Andersson said yes, and the passer-by went back to his vehicle, got his gun and told the suspect to stop the attack, Milstead said. When he didn't, the driver shot him.

Prosecutors said they were not commenting yet on whether they will review the shooting by the driver because it is an ongoing investigation.

Investigators were trying to determine how the rollover happened and whether the suspect was involved with the initial report of gunshots, officials said. Investigators plan to speak with the person who made that call.

Milstead said he feared the worst when he headed to the hospital to check on Andersson.

"He's incredibly fortunate to be here with us today," the director said.