(CNN) -- They thought the tonsil surgery would help her. She feared she'd never wake up.
Now, a 13-year-old girl once known for smiling, giggling and dropping off her sister every day at kindergarten lies motionless in a California hospital bed, hooked up to machines that doctors say are the only thing keeping her heart beating.
There have been days of prayers and protests for Jahi McMath. There was a fierce court battle as a devastated family fought to keep her on life support and doctors argued she had already died. The case drew national attention and fueled debate.
Doctors and a judge have declared her brain dead and said there's no chance Jahi will come back to life.
A deadline loomed Monday as a judge had said the hospital could disconnect the machines after 5 p.m. (8 p.m. ET). But shortly before Jahi could have been cut off, that same judge extended his order to 5 p.m. (8 p.m. ET) on January 7.
"This child was sitting on death row," said family attorney Christopher Dolan. "This was a facility that was hell bent on ending this child's life today, and a court stepped in."
Children's Hospital Oakland spokesman Sam Singer said the hospital would comply with the order.
Earlier, the girl's family told reporters it had located a facility in New York willing to take Jahi. The Oakland hospital, however, "refused to agree to allow us to proceed in that matter," according to the girl's uncle, Omari Sealey.
Attorneys for the family are filing a new complaint in federal court requesting a temporary restraining order and an injunction to prevent the hospital from disconnecting Jahi from life support, he said. They also are filing an appeal with California appellate courts.
Asked about the New York facility, Singer said that the hospital has had no "substantive" conversations with any such place.
It's unclear what will happen next.
But one thing is certain, the spokesman said.
"There are no winners in this very tragic case," Singer told reporters.
Bleeding, cardiac arrest and brain death
Family members say the 8th grader was alert and talking after doctors removed her tonsils, adenoids and extra sinus tissue in a surgery earlier this month.
Doctors had recommended the surgery to treat pediatric obstructive sleep apnea, a condition which made her stop breathing in her sleep and caused other medical problems.
Before the surgery, Jahi said she was worried that she would never wake up, according to her uncle. She seemed fine after the surgery, but asked for a Popsicle because her throat hurt.
It wasn't long before something went terribly wrong.
In the intensive care unit, the girl began bleeding profusely -- an image her mother told CNN would be forever seared in her mind.
According to family members, Jahi went into cardiac arrest. Days later, she was declared brain dead.
Hospital officials have said privacy laws prevent them from discussing details of the case.
In court documents and public comments, they've maintained that there's no doubt that McMath is brain dead, describing the condition as irreversible. An independent doctor and a judge supported that conclusion last week.
"No amount of prayer, no amount of hope, no amount of any type of medical procedure will bring her back," Singer said Monday. "The medical situation here in this case is that Jahi McMath died several weeks ago."
Family raises money, searches for answers
But Jahi's family members maintain that they're hoping for a miracle and want to transfer the girl from Children's Hospital Oakland to another facility.
The girl's uncle told reporters Monday that Jahi moves when her mother speaks and touches her. Sealey also said that a pediatrician has seen Jahi and has sworn she is not dead.
When asked about the girl's possible movement, the hospital spokesman, citing privacy laws, said he would not comment directly on any claims the family makes.
However, Singer said it is "quite common" for the muscles of brain-dead patients to move, stressing it's "not a sign of life."
Media reports suggest one earlier treatment location option fell through. The attorney representing Jahi's family did not respond to requests from CNN for comment on the matter.
So far the family has raised $27,000 on GoFundMe.com to move her. According to the site, more than 800 people have donated money in three days.
Court document reveals details
Medical ethicists, meanwhile, say the high-profile case fuels a misperception: that "brain death" is somehow not as final as cardiac death, even though, by definition, it is. The case is "giving the impression that dead people can come back to life," Arthur Caplan, director of the Division of Medical Ethics at NYU Langone Medical Center, told CNN last week
CNN has obtained a copy of a medical report, contained in a court filing, that lays out in extensive detail the testing that supports the hospital's conclusion that McMath has no hope of recovery.
The report was prepared by Dr. Paul Fisher, Chief of Pediatric Neurology at Stanford University, who was appointed by Alameda Superior Court Judge Evelio Grillo to examine the girl and report his findings to the court.
Fisher found that the girl's pupils were fully dilated and unresponsive to light and that she did not respond to a variety of intense stimuli.
His report also says McMath showed no sign of breathing on her own when a ventilator was removed: "Patient failed apnea test." While the family has referred to Jahi's heart beating, the report says it is only beating because of the mechanical ventilator.
In addition, an imaging test showed no blood flow to Jahi's brain, while another showed no sign of electrical activity.
Fisher's conclusion: "Overall, unfortunate circumstances in 13-year-old with known, irreversible brain injury and now complete absence of cerebral function and complete absence of brainstem function, child meets all criteria for brain death, by professional societies and state of California."
Family criticizes hospital
Jahi's family has criticized the hospital's handling of the matter, accusing doctors of pressuring them to disconnect life support.
"We wish to acknowledge that Jahi's case, and our stance regarding her right to life, and her mother's right to make decisions regarding her child, has stirred a vibrant, sometimes polarizing, national debate. This was never our intention," the family's statement said. "We have our strong religious convictions and set of beliefs and we believe that, in this country, a parent has the right to make decisions concerning the existence of their child: not a doctor who looks only at lines on a paper, or reads the cold black and white words on a law that says 'brain dead' and definitely not a doctor who runs the facility that caused the brain death in the first place."
Singer, the hospital spokesman, described the situation Monday as tragic "by every measure of the word."
"There has been some limited conversation between the hospital's attorney and the family's attorney, but that's a privileged communication and I have no update on behalf of the hospital at this moment," he said, "other than to say our hearts, our sympathy, go out to this family and the young woman's body on the respirator at this hospital."
CNN's Mayra Cuevas, Cristy Lenz, Janet DiGiacomo, Elizabeth Landau, Dana Ford, Dan Simon, Michael Martinez and Carma Hassan contributed to this report.