A Maryland appellate court ordered a new trial yesterday for a man who was convicted of murdering two Prince George's County sheriff's deputies in 2002 as they tried to take him into custody for a court-ordered psychiatric evaluation.

James R. Logan's convictions must be reversed because the judge who presided over his trial did not adequately question potential jurors to determine their suitability, the Court of Special Appeals said.

On the night of the killings, Logan, then 23, burst out of a bedroom in his parents' home in Adelphi and shot Elizabeth L. Magruder, 30, and James V. Arnaud, 53. The deaths were the first in the line of duty for the sheriff's department.

Word of the appellate court's decision spread yesterday through the sheriff's office. Many employees were close to the slain deputies, and they did not welcome the prospect of revisiting the case or the painful details that would resurface at a new trial.

"It's not something we want to go back through again," said Col. Paul Drula, chief assistant sheriff. "However, we will stand strong and do it again if we have to. . . . We're a family. We'll work through it."

At trial in 2003, Logan's attorneys acknowledged that he killed the deputies but said that he should be acquitted by reason of insanity because he was suffering from paranoid schizophrenia and beset by delusions. Prosecutors said Logan created his mental health problems by using crack cocaine and marijuana and should be held legally responsible for the shootings.

Logan was found guilty of two counts of second-degree murder and two handgun violations and sentenced to 100 years in prison.

In the opinion issued yesterday, a three-judge panel said Circuit Court Judge E. Allen Shepherd should have questioned potential jurors more closely about their exposure to publicity surrounding the case and about their views of the insanity defense.

"Precisely because the subject matter of [the insanity defense] is a controversial one, the trial court should have inquired whether any prospective jurors had reservations or strong feelings regarding such a defense," Judge Ellen L. Hollander wrote.

Fred Warren Bennett, one of Logan's attorneys, said his client's family is ecstatic. "They truly believe that he was insane," Bennett said. "It was so out of character for Mr. Logan. He'd never had a crime of violence in his background at all."

Bennett said he believes the defense will be in a stronger position if the case goes to trial a second time. The judge would question potential jurors more rigorously, he said, and the defense would have a record of Logan's treatment for mental illness since the killings that is "inconsistent with the state's diagnosis" of drug-induced psychosis.

Hours before the killings, Logan's wife petitioned a court for the emergency psychiatric evaluation, saying Logan claimed to be hearing messages from God and thought "death is imminent." Valencia Flood Logan wrote that her husband, a father of two, was "extremely paranoid" and that his "condition is worsening each day."

Logan, she wrote, "keeps reading the Bible and is saying we are in Revelations," referring to a part of the Bible often interpreted as a description of how the world will end.

Glenn F. Ivey (D), state's attorney for Prince George's County, said he is disappointed by the decision and would ask Attorney General J. Joseph Curran Jr. (D) to take the case to the Court of Appeals, the state's highest court. Curran's office said that option is under consideration.

Arnaud's daughter, Jamey Arnaud, said she was devastated by the reversal and by the sudden realization that she and the deputies' other relatives may have to endure another trial.

"We were hoping that once it was over, my dad and Liz could rest in peace," she said. "We thought everything was put to rest."

Staff researcher Bobbye Pratt contributed to this report.