A 21-year-old man from Reseda pleaded no contest to accidentally shooting and killing a 24-year-old Sun Valley woman near a Tarzana hiking trail last December, authorities said.

Heriberto Gonzalez entered the plea Thursday to one felony count each of involuntary manslaughter and assault with a firearm, the Los Angeles County District Attorney’s Office said. He also admitted the handgun use allegations.

Gonzalez, also known as “Kirby,” was immediately sentenced to eight years in state prison, said Deputy District Attorney Brad Harmon in a statement.

RELATED STORY: Woman from Sun Valley fatally shot after Tarzana hike, man arrested

On Dec. 4, 2016, Gonzalez and a group of friends, which included victim Angela Hernandez, were at a hiking trail near Vanalden Avenue to shoot a handgun, Harmon said.

After returning to their vehicle, Harmon said, Gonzalez accidentally discharged the firearm and fatally shot Hernandez, who was sitting in the front passenger seat.

Additionally, Gonzalez’s plea included an unrelated crime where he shot at a car near Sherman Way and Haskell Avenue on Sept. 19, 2016, authorities said.