A 24-year-old man accidentally shot himself in the foot on a mountain camping trip in Boulder Canyon Thursday night and still managed to drive himself to the hospital, police say.

The unidentified man was treated for non-life-threatening injuries, said a Friday Boulder County Sheriff’s Office news release.

The man who shot himself was driving into the canyon with his wife and a cousin, who also was not identified by deputies, at around 7 p.m. Thursday when the cousin asked to look at his relative’s gun.

The victim had forgotten that his gun was still loaded and in the process of reaching for the gun and picking it up, he evidently pulled the trigger, the gun fired and a bullet struck his foot, according to the sheriff’s report.

The injured man then managed to drive himself to the hospital.