Brandon McInerney, 17, pleaded guilty to the murder charge, as well as one count each of voluntary manslaughter and use of a firearm, said Ventura County Chief Deputy District Attorney Mike Frawley. McInerney is scheduled to be sentenced Dec. 19.
The case drew wide attention because of its shocking premise: McInerney, in a fit of homophobic rage, killed 15-year-old Larry King at E.O. Green Junior High School in Oxnard because he was offended by King's dress and how the victim interacted with him.
Larry King's father, Greg King, told KABC-TV he understands why prosecutors agreed to the plea deal.
"I don't think that 21-year sentence is justice for my son, but I understand the reality that was facing the DA of trying to convict a defendant who was 14 ... when he committed the murder," Greg King said.
Comic Ellen DeGeneres, a lesbian, weighed in on her talk show shortly after the shooting and said gays shouldn't be treated as second-class citizens.
McInerney was only 14 at the time of the February 2008 shooting. Several jurors said after the teen's trial earlier this year that he should never have been tried as an adult.
A mistrial was declared in September when jurors couldn't reach a unanimous decision on the degree of guilt. The panel took a series of votes, the last one with seven jurors in favor of voluntary manslaughter and five supporting either first-degree or second-degree murder. The trial had been moved from Ventura County to Los Angeles because of pretrial publicity.
Frawley said prosecutors agreed to the plea deal because of uncertainty about what might result from a second trial.
"We took that into account and looked at what it would take to protect the community," Frawley said. "The total time in custody for 25 years will do that."
The murder conviction will be stayed, and the plea deal calls for McInerney to be given the harshest sentence under California law for voluntary manslaughter - 11 years - and use of a firearm - 10 years, Frawley said. McInerney is ineligible for time served or good behavior because he pleaded guilty to murder.
After serving nearly four years since King's slaying, McInerney will be released just shy of his 39th birthday. Prosecutors had previously offered a plea deal that would have sent McInerney to prison for 25 years to life, but his attorneys passed.
A phone message left with defense attorney Robyn Bramson was not immediately returned.
Eliza Byard, executive director of the Gay, Lesbian & Straight Education Network, said in a statement the plea agreement ends a tragic chapter.
"Ventura County along with communities and school districts everywhere must come together to promote a culture of respect and nurture the true potential found in every individual regardless of sexual orientation, gender identity, or gender expression," Byard said.
King was shot twice in the back of the head in front of stunned classmates. Authorities maintained the shooting was premeditated and deserving of a murder conviction. During the trial, prosecutors noted at least six people heard McInerney make threats against King in the days before the shooting.
Prosecutors also contended McInerney embraced a white supremacist philosophy that sees homosexuality as an abomination. Police found Nazi-inspired drawings and artifacts at his house, and a white supremacist expert testified at trial the hate-filled ideology was the reason for the killing.
Prosecutors, however, dropped a hate crime count against McInerney in preparing for a second trial.
Defense attorneys acknowledged McInerney was the shooter but explained he had reached an emotional breaking point after King made repeated, unwanted sexual advances. They also argued their client came from a violent upbringing and juvenile court would have been the best venue to try him.