A Northern Virginia farm worker, who has been sentenced to life imprisonment for a brutual 1971 shotgun murder, yesterday was ordered freed from prison by a federal appeals court because of a judicial error by a Prince William County judge.

The court order overturning the conviction of Terry Lee Harris, now 35, for the premeditated slaying of a 16-year-old Prince William County girl prompted dismay among county officials. "He's the kind of man that should not be on the street," said county prosecutor Paul B. Ebert.

Harris was convicted of firing three shotgun blasts into the body of Joyce Hutchinson at her home near Haymarket on the night of Dec. 19, 1971 -- shortly after she had broken her engagement to him, according to Ebert and other lawyers familiar with Harris' trial. Harris reloaded his shotgun after each blast, they said.

After his conviction, Harris asked to be executed for the crime, the lawyers said. At the time, however, capital punishment had been abolished in Virginia.

A three-judge federal appeals panel ruled in an order made public yesterday, however, that Harris' conviction was improper and that Harris must be released from the state penitentiary at Richmond, where he has been imprisoned since Oct. 27, 1972.

The appellate panel held that Harris was unconstitutionally subjected to double jeopardy because of an order by Circuit Court Judge Percy Thornton Jr. Thornton had abruptly halted Harris' first trial by declaring a mistrial after a legal dispute over photographic evidence. Thornton later presided at Harris' second trial.

The appeals court ruled that Thornton was in error when he declared the mistrial. "Because the first trial was improperly aborted, Harris had a constitutional right not to be retried and his subsequent conviction cannot stand," the appellate panel said in an order by Clement F. Haynsworth, chief judge of the 4th U.S. Circuit Court of Appeals.

Assistant Virginia Attorney General Linwood T. Wells Jr., who represented the prosectuion during the federal court review of Harris' conviction, said yesterday that he did not plan to appeal the court's decision. c"I have a real question in my mind if we would prevail [on appeal]," Wells said.

Harris is expected to be freed from prison shortly, according to state officials. His release will be ordered by the U.S. District Court in Alexandria after the court is formally notified of the appellate dicision. If his conviction had been upheld. Harris would first have become eligible for parole in 1987, officials said yesterday.

Judge Thornton declined to comment on the appeals court ruling yesterday, saying, "I honestly cannot recall the details [of Harris' two trials]."

Two court-appointed lawyers who represented Harris -- Peter D. Weimer of Manassas and Ralph S. Spritzer, a University of Pennsylvania law professor -- said in telephone interviews yesterday that Judge Thornton had angrily interrupted the trial before ordering a mistrial.

"The judge hit the ceiling because his order [dealing with photographic and other evidence] had been violated and siad 'I'm going to declare a mistrial,'" said Spritzer, who represented Harris during the federal proceedings. "It's just a case of a judge who went completely off the tracks."

Weimer, who reprsented Harris during the trials, and Ebert, the county prosecutor, both objected to the declaration of a mistrial.

The appeals panel said in its ruling that the dispute over the admissibility of photographic evidence could have been settled by the judge during Harris' first trial without declaring a mistrial. The second trail imposed an unconstitutional burden on the defense in violation of Fifth Amendment strictures against double jeopardy, the court held.