Andrea Yates' (search) murder conviction for drowning her children in the bathtub was overturned by an appeals court Thursday because a psychiatrist for the prosecution gave erroneous testimony that suggested the Texas mother got the idea from an episode of "Law & Order."

The ruling means Yates is entitled to a new trial, though prosecutors said they would try to have the conviction reinstated.

Yates, 40, is more than two years into a life sentence after a trial that stirred national debate over mothers who kill, postpartum depression and the legal definition of insanity.

The appeals court ruling turned on the testimony of Dr. Park Dietz (search), a forensic psychiatrist who consulted for "Law & Order" and helped prosecutors land a conviction in 2002. Dietz testified at the trial that shortly before Yates' crime occurred, a "Law & Order" episode ran about a woman who drowned her children and was found innocent by reason of insanity.

But it turned out that no such "Law & Order (search)" episode existed.

"We conclude that there is a reasonable likelihood that Dr. Dietz's false testimony could have affected the judgment of the jury," a three-judge panel of the First Texas Court of Appeals said.

A receptionist at Dietz's Newport Beach, Calif., office said Thursday that neither Dietz nor his firm had an immediate comment on the ruling. In its ruling, the court noted Dietz "acknowledged that he had made an error in his testimony."

On June 20, 2001, Yates drowned her five children one by one, then called police to her Houston home and showed them the bodies of Noah, 7, John, 5, Paul, 3, Luke, 2, and 6-month-old Mary.

Yates pleaded insanity, and according to testimony at the trial, she was overwhelmed by motherhood, considered herself a bad mother, suffered postpartum depression, had attempted suicide and had been hospitalized for depression.

Five mental health experts for the defense testified that she did not know right from wrong or that she thought what she did was right.

Dietz, a nationally known authority who took part in the Jeffrey Dahmer and Unabomber cases, was the lone mental health expert to testify for the prosecution, and the only one to say she knew right from wrong. Ultimately, the jury rejected her claim of insanity.

"His testimony was critical to establish the state's case," the appeals court said. "Although the record does not show that Dr. Dietz intentionally lied in his testimony, his false testimony undoubtedly gave greater weight to his opinion."

In his testimony, Dietz said he consulted for the popular NBC series, and added: "As a matter of fact, there was a show of a woman with postpartum depression who drowned her children in the bathtub and was found insane and it was aired shortly before the crime occurred."

Later, during closing arguments, a prosecutor referred to the Dietz testimony to suggest that Yates learned from the TV show a way to escape responsibility for her actions. The prosecutor told the jury: "She watches `Law & Order' regularly, she sees this program. There is a way out. She tells that to Dr. Dietz. A way out."

The error in Dietz's testimony became known to prosecutors and jurors before the sentencing phase in 2002. The defense asked for a mistrial because of it, but the judge refused. The jury ultimately spared her from the death penalty.

The appeals court absolved the prosecutors of any wrongdoing. And Joe Owmby, who prosecuted Yates, said Thursday that he had no reason to doubt Dietz at the time.

"We fully intend to pursue a motion for a rehearing," said Harris County Assistant District Attorney Alan Curry.

Yates was thrilled by the news after learning of the ruling at the psychiatric prison where she is serving her sentence.

"She smiled and said she was basically just kind of in shock," said Todd Foxworth, warden at the Texas Department of Criminal Justice Skyview Unit, who delivered the news. "But she was very happy. Physically and mentally, she's doing as well as I've ever seen her."

Yates' husband, Russell Yates (search), said in a televised interview Thursday, "I'm happy, happy for Andrea."

"I think she needs to be in a state mental hospital until she's well," said Yates, who has filed for divorce. "Had she not been mentally ill, she never would've done what she did."

Defense attorney George Parnham (search) said he had no plans to seek her release from the prison about 140 miles north of Houston, where she works in the flower garden and has janitorial duties.

"Andrea is where she needs to be right now, as far as security is concerned for her," he said. "The last thing Andrea needs, quite frankly from my perspective, is to walk from the TDCJ Skyview Unit into the public arena."

The Yates case, and others in Texas where the insanity defense was cited, have prompted Texas legislators to take another look at the state's insanity laws. The case also stirred debate over whether postpartum depression is properly recognized and taken seriously.