A man arrested in the killing of an Arizona police officer carefully balanced a semi-automatic rifle on the roof of his vehicle during a traffic stop and fired two shots, striking the officer in the head before he even got out of his patrol car, according to court documents released Tuesday.

Elijah Arthur remained in custody awaiting a June 3 detention hearing in federal court on a first-degree murder charge.

The FBI is the lead investigating agency given the shooting occurred in the Salt River Pima-Maricopa Indian Community on the outskirts of Phoenix.

The criminal complaint says Officer Jair Cabrera, 37, of the Salt River Police Department, which patrols the community, pulled over a vehicle driven by Arthur at about 3 a.m. Saturday while assigned to a DUI unit.

Surveillance video from a nearby gas station shows Arthur stepping out of his vehicle and positioning a rifle on the roof of the car aimed at Cabrera, the complaint states.

"Officer Cabrera is seen adjusting the police vehicle spot light, still seated in the police vehicle as Arthur shoots twice, first striking the police vehicle's right-side mirror, and then striking Officer Cabrera in the head," FBI Special Agent Patrick York wrote.

Authorities said Arthur then fled the scene and was arrested a short time later. Cabrera was taken to a nearby hospital where he was pronounced dead.

After his arrest, Arthur appeared intoxicated and denied having any memory of the shooting "because he was drunk and said he blacked out," according to the complaint.

Authorities said he later acknowledged firing two shots but claimed he was aiming at gas pumps and didn't intend to shoot the officer.

A passenger in the vehicle who had not yet been charged told authorities that he prayed the officer would not stop them because he knew there was a rifle in the car and he "had a feeling something bad would happen," the complaint states.

FBI spokesman Perryn Collier said the investigation was ongoing, and three people, including Arthur, had been detained.

Arthur had no outstanding warrants and no previous violent criminal history, his federal public defender, Jane McClellan, said.

Arthur had not yet entered a plea, and McClellan declined to discuss the case.

Officials with the Salt River Pima-Maricopa Indian Community, where Arthur is a tribal member, referred questions to the Salt River Police Department. A telephone message left for police wasn't returned Tuesday.

A funeral for Cabrera is set for Friday.