ST. LOUIS (AP) — A man is hospitalized with non-life threatening injuries after ordering two men out of a car at gunpoint, only to find it was occupied by St. Louis detectives who shot him, police said Tuesday.

Interim Police Chief Lawrence O'Toole said the detectives were following a Nissan believed to be taken in a carjacking. When their unmarked car pulled up to a traffic light next to the Nissan, a 21-year-old man got out, pointed an assault-style weapon at the officers, and demanded they get out, O'Toole said.

Police do not believe the suspects knew the car was occupied by officers.

The detectives and gunman exchanged shots. The suspect was struck several times in the arms and legs. He underwent surgery but is expected to recover, O'Toole said.

The driver of the Nissan sped away. The car was recovered a short time later. O'Toole said it wasn't clear if other suspects were in the car, which police later learned had been taken in an October carjacking. They also learned that the weapon used by the gunman had been stolen.

"This is the same type of weapon we've had officers shot with," O'Toole said. "Officers encounter this type weapon almost on a daily basis."

Both detectives are in their mid-30s and are nine-year veterans of the police force. One was treated for facial injuries from broken glass, O'Toole said.

The suspect's name was not released. O'Toole said he is from St. Louis County.

It was the second officer-involved shooting in St. Louis in less than a week. On Thanksgiving Day, 17-year-old Rehyen Bost-McMurray was fatally shot by officers who said he pointed a gun at them. A 14-year-old was also shot but survived.