ST. LOUIS — A gunman wearing a bandanna over his face opened fire on a uniformed St. Louis police sergeant before dawn Tuesday, peppering his windshield with at least a dozen rounds, and the police chief credited the officer’s body armor with saving his life.

Police Chief Sam Dotson said the officer sustained a torso injury not considered life-threatening during the hail of gunfire on his private vehicle shortly before 5 a.m. in the city’s tony Central West End neighborhood. Dotson called the attack a “brazen act of violence.”

The officer, who was working security as a second job, managed to return fire and believes he may have wounded one of the four men who occupied the car from which the gunman emerged, Dotson said.

The officer and the four suspects are black, police said.

“They targeted, they ambushed, they tried to assassinate a police officer,” the chief told reporters outside the hospital where the officer was treated and later released. “What we saw tonight are individuals that were armed, that targeted a police officer and had no second thoughts, no remorse about it at all.”

“What we saw today are guns in the hands of criminals and their willingness to use them,” Dotson said.

Dotson said the officer had been monitoring three people walking down the street, but did not engage them before they left the area.

Moments later, a silver or gray vehicle occupied by four people, including the walkers, pulled up in front of the sergeant’s car, Dotson said. The gunman stepped out and began firing at the officer, then fled on foot as the suspect’s car sped away.

The wounded officer drove after the gunman but lost sight of him in a parking garage, Dotson said, crediting the officer’s ballistic vest for saving his life.

Investigators planned to obtain footage from an abundance of surveillance cameras in the area, Dotson said.

He did not release the injured officer’s name but said he is a 16-year veteran of the force.