A mental patient who killed his former boss in reaction to an imagined government plot to eliminate social misfits was found not guilty by reason of insanity yesterday by a Fairfax County Circuit Court jury.

Richard Miller, 29, of Silver Spring, a former department store clerk and telephone operator, had been charged in the murder of John Kwarta, 39, last Nov. 17.

The jury deliberated for 13 hours before reaching its verdict, and was deadlocked 8 to 4 at one point over several issues, including Miller's fate if he were found not guilty by reason of insanity, said foreman David DeFatta.

"The people were concerned, even though that was not our job," said DeFatta, a 55-year-old engineer. "You're part of society, and I'm part of society, and they were afraid that this person who has this deranged homicidal mind would walk the streets."

Miller, a pale man with dark rings under his eyes who sat sedated and immobile during his trial, will remain in custody, according to Judge Thomas J. Middleton.

He will be examined by two physicians and a clinical psychologist to determine if he is insane or mentally retarded and whether, if discharged, he might constitute a danger to himself or to society, Middleton said.

The experts will report back to the court; no date has been set.

Defense attorney Peter D. Greenspun called the case a difficult one and said he hoped Miller will now receive the psychiatric help he requires. Deputy Commonwealth Attorney V. Britt Richardson Jr. had hoped for a first-degree murder conviction, and said Miller would have received mental help if he had been found guilty.

Richardson reiterated, however, the prosecution's position that Miller should have been held responsible for his actions.

It was a case in which no one won. So painful was the trial for Kwarta's family and for Miller's parents that they sat together during the opening arguments, holding hands. "It's tragic, obviously," said Greenspun.

All psychiatrists and psychologists who testified at the six-day trial described Miller as a chronic paranoid schizophrenic who suffers from psychotic delusions and suicidal, as well as homicidal, tendencies.

They said he suffered from various delusions, the most prominent being the government-plot theory that Miller named "Demographic Eugenics," after a phrase he had heard while watching Mr. Spock on the TV show "Star Trek." Many things Miller saw seemed to him to validate this theory. For example, he saw the spread of AIDS as a federal plot to get rid of prison inmates.

He thought the media was beaming subliminal suicide messages to misfits such as himself and, in response, tried several times to commit suicide by inhaling propane. He saw messages in the "WKRP in Cincinnati" TV program and in movies such as "Rambo," which he saw 20 times.

Miller's father Robert, a deputy court administrator in Prince George's County, and others testified that Miller had had a normal middle-class military upbringing: He played Little League baseball, got As and Bs in school and was an Eagle scout. However, he said, Miller's thoughts became increasingly aberrational as he reached young adulthood.

Eventually, health experts testified, it was Demographic Eugenics that compelled Miller to kill Kwarta, even though he had had no contact with him for nine years, since they worked together at a now-closed Memco store in Camp Springs.

Miller knew murder was against the law, according to testimony, but he believed he was killing Kwarta for the benefit of society.

Miller stalked Kwarta for four days before staging a minor traffic accident in Kwarta's apartment parking lot at Belle Haven Towers, off Rte. 1, just south of Alexandria. When Kwarta got out of his car to inspect the damage, Miller shot at him 28 times, stopping once to walk slowly back to his car, reload the 9mm Browning pistol, then fire another round. After Kwarta lay dead, Miller slowly drove away.

It was also a case in which the lawyers had a difficult time trying to select a jury, partly because of the controversy the John W. Hinckley Jr. case has brought to the insanity defense, said Greenspun.

Another problem was the jurors' inability to agree on the proper definition of Virginia's stringent insanity rule -- whether an inability to distinguish "right from wrong" means right in the legal sense or in the moral sense.

The impasse was broken when Judge Middleton ruled in favor of the moral interpretation espoused by the defense.