A California teenage boy was killed on Thursday when a bullet struck him while police were firing at a pit bull charging toward them, police said.

Five deputies were at an apartment complex in Palmdale about 3:40 a.m. when a 3-year-old blue-nosed pit bull came charging toward them, biting one officer in the leg, Los Angeles Times reported. The teenager, who was identified by family members as Armando Garcia-Muro, was at the scene and restrained the pit bull after the first incident.

PIT BULL MAULS 2 KIDS STRAPPED IN CAR SEATS INSIDE MINIVAN

Moments later, however, the aggressive dog came charging toward them again, prompting deputies to open fire. A bullet struck Garcia-Muro in the chest when it ricocheted off the ground. The deputy who was bitten by the dog was also struck in his right leg by a bullet fragment, according to police.

"He may have been struck by one of the skip rounds in what we’re calling an extremely, extremely unfortunate incident," Los Angeles County Sheriff's Department Homicide Bureau Capt. Christopher Bergner said.

Bergner added that the deputies might not have seen the teen in near the dog.

Garcia-Muro was rushed to the hospital and pronounced dead. The injured deputy was also hospitalized and treated. He was later released.

NEVADA PIT BULL MAULS 6-MONTH-OLD BABY TO DEATH

The dog suffered a gunshot wound, but will later be euthanized, The Los Angeles Times reported.

The pit bull was about 60 to 65 pounds and belonged to the teen's neighbor. The owner told the newspaper her dog is well-mannered and that its "not [the dog's] personality" to charge at people.

Garcia-Muro's family members said the teenager was a senior at R. Rex Parris High School and the oldest of four siblings.

"He would give his life for anybody," Alcantar told the newspaper. "He was a very loving person."