Deputy Erick Gelhaus fired multiple rounds at Andy Lopez in response to what he believed was an imminent threat of death, Sonoma County District Attorney Jill Ravitch announced at a news conference.
"While in the lawful performance of his duty, Deputy Gelhaus was faced with a highly unpredictable and rapidly evolving situation," Ravitch said. "He believed honestly and reasonably that he was faced with a do or die dilemma."
Gelhaus shot Lopez on Oct. 22 as the teen walked in a Santa Rosa neighborhood with a pellet gun that resembled an automatic weapon. The deputy told investigators he believed the gun was real and opened fire out of fear for his life.
Gelhaus fired eight times, striking the eighth-grader seven times with his department-issued 9 mm handgun.
Protesters in the mostly Latino community said the deputy did not give ample warning before the shooting. Investigators have said 10 seconds elapsed between the time Gelhaus and a trainee reported a "suspicious person" and then reported shots fired to dispatchers.
The trainee did not open fire.
Ravitch said her office's findings will not alleviate the pain felt by Lopez's family or the community. The boy's family has filed a lawsuit against the county.
The FBI has said it also is looking into the shooting to determine if any civil rights violations occurred.
Officials have been preparing for possible protests after the announcement by prosecutors.