A San Diego police officer was shot in the head Saturday in an apparent unprovoked attack and a suspect died later in a shootout with police, officials said.

Police told the San Diego Union-Tribune (http://bit.ly/nnZSaT ) that the officer was wounded as he waited at a stop light alongside a vehicle suspected of being involved in a shooting hours earlier.

The officer, whose name was not released, was in critical condition at Scripps Mercy Hospital in Hillcrest.

The report said he was shot around 5:30 p.m. when he pulled up to a black Audi in the City Heights area on the city's eastside and a passenger in that car shot him.

"As far as we know, it was totally unprovoked," Police Capt. Jim Collins told the newspaper. "He was not attempting to stop the suspect vehicle. He had no idea that was the suspect vehicle."

He said the shooting led police to track down the vehicle to a nearby apartment, where they got involved in a gun battle and fatally shot one suspect.

Police believed a second suspect was holed up inside and surrounded the apartment, but later found the unit was empty.

The Audi was suspected of being involved in a shooting at an In-N-Out restaurant about two hours earlier and 14 miles away in El Cajon. Police chased the vehicle on the freeway, but had to give up after it sped more than 100 mph.