PHOENIX — An Arizona man was sentenced to six months in jail for felony child abuse for leaving his 5-year-old granddaughter in the desert with a loaded and cocked handgun with the instruction to “shoot any bad guys,” prosecutors said Wednesday.

Paul Armand Rater, 54, pleaded guilty to one count of felony child abuse under a plea agreement stemming from the November 2015 incident, said county attorney Bill Montgomery.

“There still has been no satisfactory explanation for why that happened,” Montgomery said at a news conference.

Authorities said the girl was reported missing by family members four hours after Rater took her for a ride in his new pickup truck.

The girl was found holding a .45-caliber pistol during a search of the area by her mother and an off-duty firefighter, court records stated.

She told sheriff’s detectives that she had been told to “shoot any bad guys,” and added, “I don’t know why Papa left me.”

Rater was located at a store and he admitted to leaving the girl under a tree with his gun after his vehicle apparently had broken down and he left to seek help. He then proceeded to go into an establishment where he had drinks and a cheeseburger, court records showed.

In addition to the jail time, Rater was also sentenced to 10 years probation at his Monday sentencing hearing in Maricopa County Superior Court in Phoenix.

Rater’s attorney, Robert Ditsworth, could not immediately be reached for comment Wednesday.

Rater was arrested last November on two counts of felony child abuse and one count of felony child endangerment for abandoning the child. He reached the plea deal in March.