A divided federal appeals court panel set aside Oliver L. North's convictions in the Iran-contra scandal yesterday, flatly reversing one of the three guilty verdicts and ordering elaborate hearings to determine if his entire trial was impermissibly tainted by earlier testimony he gave Congress under a grant of immunity from prosecution.

In a 2 to 1 decision, the court said North was entitled to a "witness-by-witness" inquiry to find out whether any of the former White House aide's widely televised congressional testimony in July 1987 was used against him.

The panel said the trial judge, U.S. District Court Judge Gerhard A. Gesell, erred in failing to hold fuller hearings to make sure Iran-contra prosecutors had made no use of North's immunized testimony.

The majority opinion also said Gesell gave faulty instructions to the jury, warranting reversal of North's conviction for illegally aiding and abetting the destruction of government documents.

The ruling set up a huge hurdle for independent counsel Lawrence E. Walsh. It could require a new trial for North. It could even lead to dismissal of the indictment against him.

Walsh, who is still investigating the Iran-contra affair, said in a prepared statement that he was still studying the opinions, which cover 216 pages, "to determine the prosecution's next step."

The appeals panel ruling could also shake the felony convictions of North's old boss, former national security adviser John M. Poindexter, who was found guilty last April on five counts for deceiving Congress about the Reagan administration's secret 1985 arms-for-hostages shipments to Iran and the diversion of profits from those sales to the contra rebels fighting in Nicaragua. Poindexter, who also testifed before Congress in 1987 on a grant of immunity, is appealing his six-month prison sentence.

North, who was in Baton Rouge, La., campaigning for a Republican senatorial candidate, said he was "very pleased" by the decision.

"It has been, for my family and me, 3 1/2 long years and a bitter legal ordeal," North told reporters. "And we've been under virtual siege. I certainly hope that the special prosecutor ends it now."

The majority ruling was made by Circuit Court of Appeals Judges David Sentelle and Laurence Silberman, appointees of former president Ronald Reagan. Chief Judge Patricia Wald, an appointee of former president Jimmy Carter, dissented strenuously.

In sending North's case back to Gesell, the majority said North's Fifth Amendment rights against self-incrimination may have been violated in light of a 1972 Supreme Court decision, Kastigar v. U. S.

"A central problem in this case is that many grand jury and trial witnesses were thoroughly soaked in North's immunized testimony, but no effort was made to determine what effect, if any, this extensive exposure had on their testimony," the ruling stated.

The court majority said Gesell "concentrated only on the independence of leads to witnesses" the prosecutors relied upon "rather than on the substance of their testimony."

As a result, they said, "if the prosecution is to continue," Gesell must hold full hearings "that will inquire into the content as well as the sources of the grand jury and trial witnesses' testimony.

"That inquiry," the court continued, "must proceed witness by witness; if necessary, it will proceed line by line and item by item." For each witness, prosecutors must show "by a preponderance of the evidence that no use whatsoever was made of any of the immunized testimony either by the witness or by the Office of Independent Counsel in questioning the witness."

If the prosecution fails to do this "with respect to any item or part of the testimony" of any grand jury or trial witness," Gesell must then consider whether that failure is "harmless beyond a reasonable doubt."

If it turns out that the government has in fact introduced trial evidence that fails these tests, the court said, "then the defendant is entitled to a new trial. If the same is true as to grand jury evidence, then the indictment must be dismissed."

Wald dissented sharply, saying "North received all of the constitutional protections to which he was entitled."

"North received a fair trial -- not a perfect one, but a competently managed and a fair one," Wald said. She said a few errors were made, but none of them, singly or cumulatively, "rose to the status of reversible error." North's conviction on all three counts, she said, should be affirmed.

Walsh could appeal for Supreme Court review, he could ask the full Court of Appeals for reconsideration, or he could accept the remand. If he decides to proceed before Gesell, Walsh said his original trial team would come back to represent his office. Meanwhile, he said, "our other ongoing investigations will continue."

The self-described "fall guy" of the Iran-contra scandal, North was convicted in May 1989 of obstructing Congress, unlawfully altering and destroying government documents, and taking an illegal gratuity from one of his confederates. He was put on two years' probation, fined $150,000 and ordered to perform 1,200 hours of community service.

In overturning the guilty verdict on the documents charge, the two-judge majority faulted Gesell for refusing to tell the jury that it had to be unanimous about whether North illegally "destroyed" documents, whether he illegally "altered" them, or whether he illegally "removed" them from his National Security Council office.

Sentelle and Silberman said reversal was required since "some jurors may have concluded that North knew only that destroying official documents was unlawful, while other jurors may have believed that he knew only that altering {Top Secret} . . . documents was unlawful, and still others may have believed that he knew only that removing documents from his office after being fired was unlawful."

Wald argued that it was sufficient for Gesell to have told the jury, as he did, that their verdict must be unanimous "on any aspect of this case."

The majority said reversal of the documents charge was also required because Gesell's instructions to the jury on whether North felt authorized by superiors to destroy the documents were too restrictive. They said the law underlying this count "requires subjective knowlege of unlawfulness for conviction."

Wald protested that the majority position amounted to an "open-ended invitation for juries to exonerate defendants who simply follow orders."

In her dissent, Wald also emphasized "the fact that nearly all of the grand jury witnesses" who testified about the three counts on which North was convicted appeared before the grand jury prior to the time North gave his congressional testimony.

The majority replied that "North's credibility could have been compromised" by witnesses who testified about the other nine counts on which North was tried and acquitted. They also rejected Judge Gesell's ruling that using testimony of witnesses whose memories were "refreshed" by North's immunized statements was not "an evidentiary use" if the testimony was truthful.

"Kastigar addresses 'use,' not 'truth,' " the court said. "If the government uses immunized testimony to refresh the recollection of a witness . . . when the witness testifies before a grand jury . . . then the government clearly has used the immunized testimony."

Wald called the reasoning "speculative" and said there were only two grand jury witnesses whose testimony after North got immunity could conceivably have raised a problem. One of them, she said, "informed the FBI . . . in detail" about North's role at a particular meeting well before North testified to Congress.