Correction appended

A Bend police officer was legally justified in shooting a man moments after the man fatally shot himself during a traffic stop in June because the officer believed his life was in danger, the Deschutes County District Attorney's Office said Wednesday.

Timothy B. Bontrager, 36, was pulled over by police a little before 11:35 p.m. June 26 on suspicion of drunken driving.

While parked in the driveway entrance of a Lowe's Home Improvement store near Cooley Road and U.S. 97, Bontrager at one point reached into his glove compartment, telling Officers Timothy Williams and Kevin Uballez he was getting his insurance information, but then pulled out a handgun, District Attorney John Hummel said.

Uballez saw the firearm first while standing near the front passenger window of Bontrager's Toyota 4Runner, yelled "Gun," and backed away, Hummel said. Williams also backed away from the driver's side window, dropping a flashlight and notebook he was holding. Bontrager shot himself in the head, the district attorney said, then Williams drew his gun after hearing the shot and seeing a muzzle flash, and fired seven times into the SUV.

Bontrager was hit twice. An autopsy found Bontrager died from the self-inflected wound and that neither of the other two rounds that hit him would have killed him instantly, Hummel said. Williams told authorities that he fired because he thought Bontrager was trying to shoot at him or Uballez, who didn't shoot the driver. Hummel said the officer's belief that he and his colleague's lives were in danger was reasonable.

Williams has been a Bend officer since 2015 and Uballez since 2014.

It's not clear why Bontrager shot himself during the traffic stop, Hummel said. Evidence showed he was "struggling personally, professionally and with his family relationships," the district attorney said. Bontrager bought his gun legally last September.

Williams told investigators that before the shooting he noticed Bontrager had bloodshot eyes and slowed speech and saw two opened 40-ounce bottles of malt liquor inside the SUV. The driver initially handed over his license and offered to show an email with an insurance agent on his cellphone.

Hummel said Bontrager got his gun after Williams began asking him to perform field sobriety tests.

*Note: A previous version of this story misidentified the county district attorney's office involved.

-- Everton Bailey Jr.

ebailey@oregonian.com

503-221-8343; @EvertonBailey