Authorities said an off-duty Houston police officer was forced to shoot a teenager in order to stop him and another teen from attacking a shopper Sunday night.

The officer was driving westbound on W. Gulf Bank just past the North Freeway around 9 p.m. Sunday when he noticed two teens who seemed to be hiding, crouched behind a fenced dumpster by the X-Press Stop convenience store.

Investigators said when he looked back, the officer saw the two teens jump up and attack another man who was leaving the store. Tho pair then started beating the victim.

The officer turned his truck around, got out and approached the attackers. Police said he repeatedly yelled at them to stop beating the man.

Police said one of the attackers saw the officer, but ignored his pleas. One of them had a gun under his shirt, which he pulled out and pointed at the officer. That's when Officer C. Rodriguez, fearing for his own safety, as well as the safety of a passenger that was in his truck, fired his gun and shot 17-year-old Oscar Gaspar.

Officials said the injured Gaspar tried to run away, but later died from his wounds.

The second teen ran away, but was captured at a residence on the other side of the North Freeway.

The beating victim was not seriously injured.

Officer Rodriguez, who has been with the department for 21 years, was not injured during the incident.

The HPD Homicide and Internal Affairs Divisions, as well as the Harris County District Attorney's Office, are investigating as is customary with officer-involved shootings.