Story highlights Brandon McInerney, 17, pleaded guilty to killing 15-year-old Lawrence King

The sentence includes 11 years for manslaughter and 10 for using a firearm

A jury earlier deadlocked on whether to convict McInerney of murder or manslaughter

Victim's father reads a statement in court

A Southern California teen who pleaded guilty to killing a gay classmate was sentenced Monday to 21 years in prison.

Brandon McInerney, 17, will serve time in a juvenile detention center until he turns 18, at which point he will be transferred to the custody of the California Department of Corrections and Rehabilitation. He will get no credit for time already served, and was ordered to pay $10,000 in restitution.

In September, a judge declared a mistrial in the case of McInerney after a nine-week trial when jurors said they were hopelessly deadlocked on whether he should be found guilty of manslaughter or murder in the death of Lawrence King. He was set to be retried as an adult.

But last month, McInerney agreed to plead guilty to killing King "under the penal code sections for both murder and voluntary manslaughter," as well as to using a firearm in that crime. He will serve 11 years for manslaughter and 10 years for the use of a firearm.

McInerney was 14 years old when he brought a handgun belonging to relatives to E.O. Green Junior High School in Oxnard, prosecutors said.

He shot the 15-year-old King twice at point-blank range in the back of the head, while both were typing papers in a computer lab for their English class along with two dozen students and their teacher, authorities said.

Friends said King, an eighth-grader who lived in a group home called Casa Pacifica, was proud of being openly gay. He liked wearing jewelry and makeup to school and he often wore high-heeled boots with the school uniform. He asked his teachers to call him Leticia instead of Larry. Some students bullied him, pupils said.

Other students said McInerney was also subject to some harassment because King had a crush on him and made it publicly known.

The victim's father, Greg King, read a statement in court Monday on behalf of Larry's mother.

"I will never forgive you for what you did," she wrote. "You have left a big hole in my heart where Larry was."