A St. Louis police officer fatally shot a suspect who tried to pull a gun from his pocket during a struggle early Thursday, the police chief said.

The shooting happened moments after a 7-year-old girl jumped out of the car where the struggle took place and ran to her mother, who was on the street nearby. The man killed was 28 years old and black; the officer who fired the fatal shot was the same age and also black.

Police Chief John Hayden said two officers were patrolling an area known for drug activity just before 1 a.m. when they noticed several people around a car and their suspicions were raised.

When the officers approached the car they found a man with marijuana on his lap, Hayden said. The child also was in the car.

Police said the man refused to get out, so the 28-year-old officer and his 24-year-old white partner pulled him out.

As the struggle continued, the younger officer “notices there’s a gun that the person is trying to remove from his pocket,” Hayden said.

Efforts to subdue the man with a stun gun were unsuccessful, Hayden said. The 28-year-old officer shot the man in the chest.

The suspect was pronounced dead at a hospital. The names of the suspect and the officers have not been released. The department’s Force Investigation Unit is investigating.

Hayden did not know if the suspect was the father of the child who was in his car.

Police recovered a fully loaded revolver and marijuana, Hayden said. The 24-year-old officer suffered a minor hand injury.

It was the second fatal officer-involved shooting in the St. Louis region in six days. On Saturday, 23-year-old Terry Tillman, who was black, was killed by an officer in the St. Louis County town of Richmond Heights. That shooting remains under investigation.

Police said the officer noticed Tillman with a gun inside the St. Louis Galleria shopping mall. Concealed carry is legal in Missouri but mall policy prohibits weapons. Tillman ran out of the mall when the officer tried to confront him. The officer gave chase and shot Tillman in a parking garage.

St. Louis County police said Tillman pointed a gun at the officer.