Updated

A driver who shot and killed an illegal immigrant who was attacking an Arizona state trooper on the side of a highway last week believes God put him there to save the officer’s life, police revealed Monday.

"He knows that he did the right thing," said Col. Frank Milstead, director of the Arizona Department of Public Safety. "He is trying to reconcile that in his mind, which, it's difficult to take a life, even when you know it’s the right thing to do."

PASSING DRIVER KILLS MAN ATTACKING ARIZONA TROOPER ON ROAD

The shootings unfolded last Thursday morning along Interstate 10 outside Phoenix. Leonard Penuelas-Escobar, an illegal immigrant and former Mexico federal police officer, rolled his car over while driving at a high speed, investigators told the Arizona Republic.

The crash threw 23-year-old Vanessa Monique Lopez-Ruiz from Phoenix out of the car. She died at the scene.

DRAMATIC RISE IN POLICE OFFICERS GUNNED DOWN IN THE LINE OF DUTY IN 2016

Penuelas-Escobar then shot at a passing car and multiple drivers called police. Edward Andersson, a 27-year veteran trooper, arrived at the scene, and as he was setting up road flares, Penuelas-Escobar shot him in the shoulder.

The motive “is the big unknown,” Milstead told reporters on Monday, according to the Arizona Republic. "I'm gonna guess that he was impaired. They were both known meth users. You can surmise that maybe there were hallucinations ... you can surmise that he was frustrated that his girlfriend was mortally injured in this collision and people wouldn’t stop (to help them)."

The Good Samaritan – who police said is not yet ready to be named – stopped and grabbed his own gun to the car and told Penuelas-Escobar to stop beating Andersson. But the illegal immigrant refused and continued, at which point the man fired at him and struck Penuelas-Escobar twice.

The Good Samaritan then started administering first aid to Andersson when Penuelas-Escobar charged back at him. The aggressor was then shot once in the head, killing him, Milstead said.

Andersson underwent surgery and was expected to recover. The Good Samaritan, police say, was headed to California for the weekend with his fiancé and occasionally practices marksmanship with those he knows in the military and law enforcement fields.

"I can tell you this: If he didn't save Trooper Andersson’s life, he definitely kept him from having much more severe neurological injuries from this beating that he was taking helplessly at the time," Milstead said.