Police investigate a scene after a St. Louis police officer was shot in what the police chief called an "ambush" on Sunday, Nov. 20, 2016, in St. Louis. Police Chief Sam Dotson said the 46-year-old officer was shot in the face. The suspect got away and a massive search was underway. (David Carson/St. Louis Post-Dispatch via AP)

ST. LOUIS (AP) — A St. Louis police sergeant was hospitalized in critical condition but expected to survive after being shot Sunday night in what the police chief called an “ambush.”

Police Chief Sam Dotson said the 46-year-old officer was shot twice in the face. The male suspect was later killed in a shootout with police.

“Fortunately for the blessing of God the officer’s going to survive,” Dotson said during a brief news conference after the shooting. He declined to name the officer but said he is a married father of three who has been with the department for about 20 years.

The officer was not involved in a call or a traffic stop but was sitting in traffic about 7:30 p.m. Sunday when another car pulled up alongside his marked police vehicle. The officer told police he heard at least two shots.

“This officer was driving down the road and was ambushed by an individual who pointed a gun at him from inside of his car and shot out the police officer’s window,” Dotson said.

Mayor Francis Slay said the officer did nothing to provoke an attack.

“He didn’t deserve this,” Slay said. “It looks like he’s going to survive. He’s going to be OK. But this is traumatic. It’s traumatic for him, his family. It’s traumatic for the city of St. Louis. He was just doing his job.”

Police reported that officers later pulled up behind the suspect’s vehicle and that he fled on foot. Police said the man fired shots at the officers, who returned fire, killing him. No officers were shot.

Police said the suspect, whose name was not released, was wanted for violent crimes and likely feared being recognized.

The attack in St. Louis came on the same day three other officers were shot, one of whom was killed.

A San Antonio detective was fatally shot in his squad car while writing a traffic ticket by someone who pulled up from behind. Detective Benjamin Marconi, 50, was a 20-year veteran of the San Antonio department.

An officer with the Gladstone, Missouri, police department near Kansas City was shot late Sunday, along with a suspect. Also, a Sanibel, Florida, officer was shot in the shoulder during a traffic stop Sunday night, and was treated and released for his injuries.

In July, a gunman in Dallas killed five officers who were working a protest about the fatal police shootings of black men in Minnesota and Louisiana. Ten days later, a man killed three officers in Baton Rouge, Louisiana. And earlier this month, two Des Moines, Iowa-area officers were fatally shot in separate ambush-style attacks while sitting in their patrol cars.

In the St. Louis area, Ballwin, Missouri, officer Mike Flamion was paralyzed from the neck down after being shot during a traffic stop in July. And St. Louis County officer Blake Snyder was fatally shot while responding to a disturbance call in October.

“This just shows the dangers of policing, not only here in St. Louis but around the country,” Dotson said.