Andrea Yates, serving a life sentence for drowning her five children--ages 6 months to 7 years--mostly stares out the window of her cell these days. But it's unclear what she sees. During a recent visit from her mother, the 40-year-old asked plaintively, "Who's babysitting the kids?" She's a lost woman, says Wendell Odom, part of her legal team, who recounted the visit. A jury in 2002 decided she was sane enough to know right from wrong, and sent her to prison instead of a hospital. But a Texas appeals court last week ruled that Yates should get a new trial.

It turns out the only psychiatrist who claimed in court that she was sane, Dr. Park Dietz, had made a serious misstatement during the trial. He testified that he consulted on a "Law & Order" episode about a woman with postpartum depression who drowned her children and was found to be insane by a court. In fact, no such program was ever produced. Nonetheless, prosecutors implied that Yates watched the show and patterned the killings after it, trying to get away with her murders. In overturning the conviction, the Court of Appeals for the First District ruled the false testimony might have tainted the jury. Harris County prosecutors immediately appealed the ruling.

George Parnham, the chief lawyer for Yates, hailed the decision. But he said it scarcely means Yates is going to walk free. He said he hopes to get her into a private mental-health-care facility "where her actions can be monitored... probably for the rest of her life."

Legal experts say a re-trial would be risky for both sides, besides being a huge undertaking that would once more evoke the unspeakable images of the drownings, one after the next. Yates, who had earlier been diagnosed with psychosis and postpartum depression, told police she was acting on instructions from Satan. It was the only way to save them, she explained, because she was a "bad mother."

Ronald Allen, a law professor at Northwestern University, says he'd "bet the mortgage" that prosecutors and defense lawyers are negotiating an agreement. "Neither side can be confident of what could happen in a new trial," he says. For the prosecution, a new trial could bring a verdict of not guilty by reason of insanity, though Yates would remain under the custody of the state. But another trial would be a roll of the dice for the defense, too, a massive legal effort that might simply result in another guilty verdict. Her husband, Rusty Yates, who filed for divorce last July, has asked that criminal charges be dropped.

Parnham said that when news of the appeal ruling reached Yates, "she was surprised and not unpleased... She understands what's happening." Dr. Lucy Puryear, who testified that Yates was insane at the time of the killings, says the woman's mind-set changes from day to day. (Yates was charged in only three of the deaths.) She spends much of the time in a daze, not quite sure of the past. But when her medication works, she remembers what she has done. During these times, Puryear says, she often "becomes too overwhelmed," refusing to eat or drink, as the memories come back to haunt, and the desperate cries of her children scream in her ears.