But Alameda County Superior Court Judge Evelio Grillo gave Jahi McMath's family until 5 p.m. Dec. 30 to file an appeal. She will stay on life support until then.
Relatives said the family has not decided if they would keep fighting.
"It's Christmas Eve, there is still time for a miracle," said Omari Sealey, the girl's uncle. He said the family would discuss and decide later whether to appeal or to allow the hospital to remove the girl from the ventilator.
Inside court, two doctors testified that Jahi couldn't breathe on her own when the ventilator was briefly removed during tests. A court-appointed doctor, Paul Fisher of Stanford University, examined her for several hours on Monday and Tuesday and told Grillo she was brain dead. The judge based his decision on Fisher's conclusions as well as those of Dr. Robin Shanahan, a doctor at Children's Hospital.
Speaking directly to the family, Grillo said they have his sympathy but that he was powerless to order the hospital to keep Jahi on life support.
"I wish I could fix it, but I can't," he said.
Children's Hospital of Oakland, where Jahi is hospitalized, has asked that the girl be taken off life support after doctors there concluded she was brain dead.
"Our sincere hope is that the family finds peace and can come to grips with the judge's decision," hospital attorney Doug Strauss said outside court after Grillo's ruling.
The girl's family has said it believes she is still alive and that the hospital should not remove her from the ventilator without its permission.
Hospital lawyers disagreed.
"Because Ms. McMath is dead, practically and legally, there is no course of medical treatment to continue or discontinue; there is nothing to which the family's consent is applicable," the hospital said in a court filing on Tuesday.
Fisher first provided his opinion to Grillo behind closed doors Tuesday morning. The doctor briefly provided his conclusions in open court that Jahi has no brain activity. He then left court without taking questions.
Shanahan, the Children's Hospital doctor, was next called to testify in the judge's chambers.
Grillo had previously ordered Jahi remain on life support until Dec. 30, or until further order from the court.
Jahi was declared brain dead after experiencing complications following a tonsillectomy at Children's Hospital.
The judge on Monday had called for Jahi to be independently examined by Fisher, the chief of child neurology at Stanford University School of Medicine.
The family's attorney, Christopher Dolan, has said he wants a third evaluation done by Dr. Paul Byrne, a pediatric professor at the University of Toledo. The hospital's attorney objected to Byrne, saying he is not a pediatric neurologist.
Byrne is the co-editor of the 2001 book "Beyond Brain Death," which presents a variety of arguments against using brain-based criteria for declaring a person dead.
In a phone interview, Byrne said he could not comment in detail because he had not seen any of Jahi's medical records. But the fact that her ventilator is still functioning properly is a sign that she is alive, he said.
"The ventilator won't work on a corpse," he said. "In a corpse, the ventilator pushes the air in, but it won't come out. Just the living person pushes the air out."
Jahi's family says the girl bled profusely after a tonsillectomy and then went into cardiac arrest before being declared brain dead.
Outside the courtroom on Monday, Dr. David Durand, chief of pediatrics at Children's, said staff have the "deepest sympathy" for the family, but that Jahi is brain dead.
"The ventilator cannot reverse the brain death that has occurred and it would be wrong to give false hope that Jahi will ever come back to life," he said.
Durand said Jahi's surgery was "very complex," not simply a tonsillectomy.
"It was much more complicated than a tonsillectomy," Durand said. He refused to elaborate, citing health care privacy laws.
Arthur L. Caplan, who leads the Division of Medical Ethics at NYU Langone Medical Center and is not involved in Jahi's case, told The Associated Press that once brain death has been declared, a hospital is under no obligation to keep a patient on a ventilator.
"Brain death is death," he said, adding, "They don't need permission from the family to take her off, but because the little girl died unexpectedly and so tragically, they're trying to soften the blow and let the family adjust to the reality."