(CNN) A person who was fighting with police along Interstate 10 near Phoenix took an officer's gun and shot two Arizona state troopers Wednesday night, killing one, authorities said.

Trooper Tyler Edenhofer -- an officer who was in training -- was killed, and Trooper Dalin Dorris was injured in the shooting in Avondale, just west of the capital, police say.

The shooting happened after troopers were called to I-10 around 10:20 p.m. about a person who was "in and out of the roadway, throwing things at cars," said Col. Frank Milstead, director of the Arizona Department of Public Safety. Police later said the objects were rocks.

The male suspect struggled with troopers and police officers from the city of Goodyear, Milstead said Thursday morning.

"During the struggle, one of the troopers lost his firearm to the subject. The subject fired at least two rounds," hitting Dorris and Edenhofer, he said.

Read More