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.