The officer, identified as 36-year-old Jeremy Henwood, was waiting at a stop light at 5:30 p.m. Saturday when a car pulled up next to him and a passenger opened fire at University Avenue and 45th Street in the City Heights area on San Diego's east side.
Police tracked the car to an apartment where they fatally shot the armed suspect, identified as 23-year-old Dejon Marquee White. Police said White wrote a two-page suicide note but it didn't say how he was going to kill himself or why.
Police believed a second suspect was holed up inside the apartment, but later found the unit was empty.
White was a suspect in a shooting that happened earlier in the day at an In-N-Out restaurant 14 miles away in El Cajon. The victim in that shooting, identified as Martin Hanna, was shot in the face as he sat in his car. Police said Hanna is expected to survive.
Police believe the attack on Henwood was unprovoked, saying he was not attempting to stop White's car when it happened.
Henwood was a U.S. Marine Corps Reserve captain and recently returned from a yearlong deployment in Afghanistan, according to the San Diego Police Dept.
The Associated Press contributed to this report.