Nothing Secretary of State George P. Shultz did in his two days of testimony before the Iran-contra committees more confounded his right-wing listeners than his repeated assertions that Ronald Reagan was indeed president of the United States -- a strong-willed, obdurate activist, insisting on his own way, impervious to contrary counsel about the Iran arms sale.

The impact of Shultz's appearance was reflected in the questions the committee loyalists put to him. They dared not question his integrity; they could not fault his memory (it was buttressed by documents galore); and he professed the ultimate loyalty: telling the truth to a president who wasn't much interested in hearing it.

Shultz has been the administration's ambassador to the real world, the solid, stable figure who had had another life before Reagan began recreating the world. He made a point of his conservatism, but it was never enough for his conservative critics. Their suspicions of him were confirmed when the news of the unforgivable offense of selling arms to Ayatollah Ruhollah Khomeini broke and he at once let it be known that he had opposed it.

He published his dissent. He had too much regard for his own reputation to take the rap for a policy that he recognized as daffy and doomed the first minute he heard of it. But he did not resign. The president could not let him go. Reagan was Shultz's political hostage. Defense Secretary Caspar W. Weinberger, who also fought hard inside, preferred to forget that he had. That's what the right wing, which was driven mad by the arms sale, thought was the decent thing to do.

On his first day at the witness table, Shultz -- with facts, dates, anecdotes, quotes -- set about clearing his own good name. He detailed the treacheries of the National Security Council staff, the lies told him by two national security advisers.

The second day, having cleared up his own record, while describing the anarchy over which Reagan presided, Shultz undertook to rehabilitate the president. He told of the president's "decisiveness," of the exceptionally good judgments he reached when given the right information. Rep. Peter W. Rodino (D-N.J.) suggested mildly that, although the president had been given the right information by Shultz and Weinberger, he had made the wrong decision about the arms sale. Shultz brusquely turned it aside.

Sen. George J. Mitchell (D-Maine), who manages to ask devastating questions in a pleasant manner, suggested that it wasn't just then-national security adviser John M. Poindexter and CIA Director William J. Casey who were shutting him out. Shultz simply would not entertain the idea that the president had deceived him by neglecting to mention that he had signed a finding for the sale at a point Shultz thought it was over.

Shultz, on the second day, resumed his courtier's mantle. If the committee was looking for a "hero," he said, it need go no further than Ronald Reagan, who, once the plot was discovered, had told everyone to tell the truth.

This was at variance with a nearly undecipherable exhibit released by the committees, the hand-written notes taken by an NSC deputy, Alton G. Keel Jr., at a Nov. 10 meeting. It could be called a "damage-control" operation or a "cover-up" session. Whatever it was, the president clearly took the lead, calling for a solid front, a unanimous denial that what had taken place was what Shultz always said it would look like -- an arms-for-hostage deal.

The Republican loyalists knew what Shultz had done. He had presented a picture of a wayward president and a lawless staff. They declared bankruptcy with their questions. They were reduced to telling him he should have resigned (Rep. Henry J. Hyde of Illinois), to importuning him to say that the scandal was not another Watergate (Rep. Dick Cheney of Wyoming), to quoting Ariel Sharon that sometimes it's okay to release terrorists from jail (Rep. Jim Courter of New Jersey), to saying he was hard on Israel (Sen. James A. McClure of Idaho).

Rep. Michael DeWine (R-Ohio) was like a terrier with a mastiff. He kept circling Shultz, yipping at his heels for not resigning, accusing him of cutting himself out of the action.

Shultz viewed him with exasperation. Finally he barked, "That's one man's opinion, and I don't share it."

Shultz was the Democrats' Oliver North. And he had exorcised North's ghost from the hearings. His testimony had weight and authority, like a performance by Sir Laurence Olivier. By contrast, North seemed a flashy star vaudeville turn. The country, watching both, would have little trouble deciding which of them should be running foreign policy.