An Arizona state trooper shot and killed a Qatari man who was in the U.S. on a student visa after he violently attacked the officer patrolling for drunken drivers along with a member of the group Mothers Against Drunk Driving, authorities said Friday.

The state trooper spotted 25-year-old Mohamed Ahmed Al-Hashemi throw a street sign onto a road in suburban Phoenix late Thursday and ordered him to pick it up, said Col. Frank Milstead, director of the Department of Public Safety.

Al-Hashemi wouldn’t pick it up, then began walking in the middle of the road and wouldn’t obey commands to stop, Milstead said.

Trooper Hugh Grant used a stun gun but it didn’t subdue Al-Hashemi, who then rushed the officer and punched and kicked him.

“It was a vicious encounter,” Milstead said before showing dashboard camera video of the attack. “He was in a fight for his life.”

The video shows the men tussling, and at one point, Al-Hashemi throws Grant to the ground.

The trooper fired his weapon, killing Al-Hashemi, the DPS chief said.

Grant feared for his life and the life of a woman riding along with him as a member of the group also known as MADD. Police often allow private citizens and journalists to come on “ride-alongs” while they patrol.

“When he began to realize this was escalating, he was trying to keep her out of danger,” Milstead said.

Authorities said they didn’t know if Al-Hashemi was impaired. The trooper had injuries to his face and head and is resting at home.

Authorities say Al-Hashemi was arrested for trespassing at the Islamic Community Center of Tempe on Wednesday. Police in the Phoenix suburb of Tempe responded to a disturbance at the mosque around 4:30 a.m. At the center’s request, officers gave Al-Hashemi a warning and told him not to return, police spokesman Greg Bacon said.

Al-Hashemi returned in the early afternoon and officers were called again. Bacon said he was then arrested on a misdemeanor charge of trespassing and booked into jail.

It’s unclear how long Al-Hashemi has been living in the U.S. He was a former student at Arizona State University, which is based in Tempe, according to school officials. They didn’t provide other details.

The Islamic Community Center of Tempe didn’t immediately respond to calls and emails seeking comment.