Image copyright Family Handout Image caption Armando Garcia-Muro was trying to restrain the dog when he was shot and killed

Los Angeles County sheriff's deputies mistakenly shot and killed a teenager when a bullet ricocheted off the pavement during a dog attack, they say. 

The 17-year-old died when a "skip" round struck him in the chest at around 03:40 local time on Thursday. 

Two officers fired shots at the dog, which moments earlier had bitten one officer's knee.  It had been restrained by the boy, but had broken free again. 

An officer was also hit in the leg by a bullet fragment, investigators say. 

Los Angeles Sheriff Captain Christopher Bergner said Armando Garcia-Muro's death was "an extremely, extremely unfortunate incident". 

"Our initial impression was [the deputies] didn't even see the individual coming around from the side of the building," he said during a press conference near the location where the shooting occurred in the city's Palmdale neighbourhood. 

Armando was about to enter his final year of high school. 

Image caption Pit bull terriers have a reputation for aggression (file photo)

"He would give his life for anybody... He was a very loving person", the boy's mother told the LA Times, adding that he loved dogs. 

Cpt Bergner said the dog was an adult male pit bull, weighing approximately 65lb (29kg), and was 5-7ft away from deputies when they opened fire. 

He said that five officers had arrived at the residence on Thursday morning after receiving reports of a loud party. 

The dog attacked deputies, who then retreated to call for backup and medical support, but it then attacked again, officers stated. 

After being struck by bullets, the dog retreated, and officers following to be sure that it was contained and unable to attack again. 

That's when they discovered Armando's body, about 30ft (10 metres) behind where the dog had been. 

Deputies provided medical aid at the scene.  He was taken to a nearby hospital where he died. 

The dog, which survived the shooting, has been euthanised.