San Antonio police are hunting a gunman after an officer was executed in his patrol car as he was writing a traffic ticket on Sunday morning.

The officer, 50-year-old Det. Benjamin Marconi, was shot after he pulled a driver over for an unspecified traffic infraction near police headquarters at around 11:45 a.m. local time, San Antonio Police Chief William McManus said during a news conference. While Marconi sat in his patrol car writing a ticket, a second vehicle pulled up behind him. The killer emerged from the second car and fired at Marconi through the passenger-side window of the squad car.

The gunman then reached inside the car and fired a second shot at Marconi before walking back to his car and fleeing the scene through the police department parking lot. Both shots fired at Marconi, a 20-year veteran, hit him in the head, McManus said.

Marconi was pronounced dead at San Antonio Military Medical Center at 12:30 p.m., FOX29 reported.

“This is everyone’s worst nightmare. You never want to see anything like this happen,” said McManus, who then ticked off several other cities that recently had police officers targeted and killed. “Unfortunately, like Dallas, like Baton Rouge, it’s happened here now.”

The Associated Press contributed to this report.