Judge Jean R. Leonard said the maximum the boy can serve would be until he is 23. He'll be eligible for parole in seven years.
The decision came after prosecutors and defense attorneys argued for months about the best placement to assure his safety and rehabilitation.
The judge said she had spent a long time considering the case and decided it was proper to commit the boy to the California Division of Juvenile Justice.
"This is an individual with exceptional needs," she said.
The judge said the boy is currently being treated with psychotropic medications and she authorized that to continue for 60 days until he is reevaluated.
While the judge noted that the sentence for the murder of his father would be 40 years to life if he was an adult, the prosecutor said outside court that the boy cannot serve that long because he is a juvenile.
His attorneys said the boy was severely abused and has serious emotional and learning disabilities from a brutal and twisted childhood.
The Riverside County boy shot Jeffrey Hall, 32, at point-blank range as he slept on a sofa on their home on May 1, 2011, after a night of drinking.
The boy told police he was afraid he would have to choose between living with his father or stepmother if they divorced.
The judge issued a seven-page ruling that she did not immediately release.
The boy, neatly dressed in a vest and white shirt, his blonde hair plastered down, peered at the judge's written ruling as she read from it. He showed no reaction but his lawyer, Punam Grewald, told The Associated Press he had called her two days ago and "he asked me 'are things going to get better?'"
She said she replied, "They will, but not right now."
Grewald said she was not surprised at the ruling, which she said was mandated by the decision that he was guilty of second-degree murder.
She said he will be the youngest inmate in the system and that there is no middle school facility at which he could be educated.
"This is a complete miscarriage of justice," she said, and promised an appeal will be forthcoming.
The Associated Press is not naming the boy because of his age. His father was regional leader of the National Socialist Movement.
On Wednesday, a Riverside County prosecutor argued that the boy should be sent to Juvenile Justice O.H. Close Detention Center in Stockton to protect him and the public, the Riverside Press-Enterprise reported.
Prosecutors have acknowledged he probably would be placed with some of the most violent offenders.
Defense attorneys, however, argued that the state isn't equipped to handle his problems and he should go to a treatment center that could meet his needs for special education and more intensive therapy, with a goal of someday allowing him back into the world.