var _ndnq = _ndnq || []; _ndnq.push([’embed’]);

PHOENIX (AP) — An attacker who shot an Arizona state trooper in a roadside ambush Thursday was himself fatally shot by a passing driver while he was bashing the officer’s head on the pavement.

The trooper suffered a severe wound to his shoulder and upper chest but he is expected to recover at a hospital.

“My trooper would not be alive without his assistance,” Department of Public Safety Director Ralph Milstead said of the good Samaritan who stopped.

The drama unfolded at an early morning rollover wreck near the town of Tonopah, on Interstate 10 in the desert west of Phoenix. In that crash, a woman was ejected and killed. She was believed to have been the passenger, and the man who shot the trooper is thought to have been driving.

Responding to a driver’s report of gunfire near the highway, the trooper spotted the wreck and stopped, Milstead and DPS Capt. Damon Cecil said. While he was putting out flares, the suspect opened fire and then physically attacked the wounded trooper, Milstead said. Both Milstead and Cecil said the trooper was ambushed.

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

He 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.

Reading this on your phone or tablet? Stay up to date on Bay Area and Silicon Valley news with our new, free mobile app. Get it from the Apple app store or the Google Play store.

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 the wounded trooper.

“He’s incredibly fortunate to be here with us today,” the director said.

Westbound Interstate 10 was closed most of the morning, and traffic heading for California and western Arizona was detoured to other highways.