After nearly four years of court dates and proceedings with nine weeks at trial this summer, Brandon McInerney, 17, pleaded guilty to voluntary manslaughter and second degree murder of classmate Larry King, who was 15 at the time. Brandon will serve 21 years in prison as a part of the plea deal, with the four years he has spent at the juvenile detention center not counting toward his sentence. He will be 38 years old when his sentence is finished.

Scott Wippert, Brandon’s defense attorney, is pleased with the deal, noting many believed Brandon would get nothing less than a life sentence.

Brandon shot Larry twice in the back of the head at E.O. Green School in Oxnard in February 2008. Larry, who was vocal about his homosexuality, wore make up and women’s clothes. Students also testified that Larry and Brandon had a volatile relationship. Brandon, who had just turned 14, had been charged with a hate crime as well as first degree murder with the special circumstance of lying in wait. The nine week trial that concluded this summer led to a mistrial, with seven jurors siding with the defense on a manslaughter charge.

Officials with the Ventura County District Attorney’s office said that retrying the case could lead to similar results, though the hate crime charge was dropped. It was the delicate nature of the case and that both Larry and Brandon were teenagers when the incident happened.

Brandon will transfer to a state prison when he turns 18 in January.