As he was preparing for his presidential campaign in 1979, Ronald Reagan toured the North American Air Defense Command, buried deep in a Colorado mountain, and asked a general what could be done to stop a Soviet nuclear missile if it were spotted by radar coming toward the United States.

"The answer was, 'Nothing,' " recalled Martin Anderson, who accompanied Reagan on the trip.

That early exchange offers a glimpse at the origins of what may be the most profound decision of the Reagan presidency: to launch the globe-spanning Strategic Defense Initiative with the hope of shielding Americans against nuclear attack, and, ultimately, abandoning a doctrine that relies on the threat of mutual annihilation to keep the peace.

President Reagan announced this plan in a nationally televised speech March 23, 1983. But interviews and documents show that he and a small cadre of conservative advisers were thinking about how to accomplish it years before that speech.

They also show that the idea, while attractive to Reagan, was purposely shunted aside in his 1980 campaign because of doubts about the technology and because of fears among his strategists that it would have been "political suicide," as one put it, to mention it at the time.

Indeed, the story of the SDI, or "Star Wars," now a six-year research program expected to cost more than $26 billion, is one of a fundamental policy shift that was nurtured quietly by a small group of committed activists: professors, physicists, members of Congress and military officials.

Then, on Feb. 11, 1983, in a meeting with the Joint Chiefs of Staff, Reagan was given a grim assessment. He was told Congress probably would never approve another big intercontinental ballistic missile program like the embattled MX, that the MX itself was in grave political trouble, that the "window of vulnerability" in Soviet missile strength was opening wider and that he needed a new "vision" of how to "leapfrog" Soviet advantages and protect the nation into the next century.

Reagan, who knows relatively little about the complexities of weapons systems but often has been captivated by dramatic ideas, thought it was time to put the idea of strategic defense before the American people.

Six weeks later he announced his new "vision" at the end of a speech that still is producing waves in American foreign policy.

What happened in the years before that speech -- how the idea of strategic defense came to be advocated by Reagan -- may shed light on his approach to nuclear arms negotiations with the Soviets, who have made the "Star Wars" program their prime target for elimination in the talks scheduled to begin next week in Geneva.

The negotiations include separate but related talks on space weapons, medium-range weapons, and "strategic" nuclear weapons, such as ICBMs.

Reagan, pressing Congress to intensify research on the SDI, has put it off-limits in bargaining with the Soviets, saying it holds the promise of "rendering ballistic missiles impotent and obsolete."

Reagan came to office thinking about the possibilities of strategic defense, of somehow shielding Americans from nuclear missiles. But events that occurred well after Reagan took office, particularly setbacks on the MX missile, actually prompted him to move ahead with the effort.

"It has a lot to do with presidents discovering the true meaning of the nuclear button," said a senior White House official. "There becomes a moral component to their reasoning."

In this case, he said, Reagan had concluded that mutual assured destruction (MAD), the decades-old U.S. doctrine that each superpower could deter war by threatening the other with annihilation, was "wrong."

Reagan, he said, was "just waiting for the Joint Chiefs to come forward with a change in national strategy." The Cocked Pistols

As early as his unsuccessful 1976 presidential campaign, Reagan was questioning the MAD doctrine. He often compared it to two men pointing pistols at each other's head, with one man's finger tightening on the trigger.

The pistols were his metaphor for the immense "offensive" weaponry of the United States and the Soviet Union. Reagan would say "there has to be another way," but he seemed to be struggling to find it. The seeds of his turn to strategic defense were planted in the mid-1970s.

The superpowers all but abandoned strategic defense with the 1972 antiballistic missile (ABM) treaty, and sought to cap the growth of offensive weapons in the strategic arms limitation talks (SALT I) agreement. But four years later, in his campaign against President Gerald R. Ford, Reagan argued that the Soviet Union had moved ahead of the United States in offensive weapons.

This view was later reinforced when then-CIA Director George Bush invited a group of hawkish outsiders to evaluate the agency's estimate of Soviet military strength. This group, known as Team B, concluded in a secret, highly controversial study that Soviet advances were far more rapid than had been thought.

By 1979, when President Jimmy Carter was struggling with SALT II, Reagan and his aides, including some Team B participants, were planning to base their campaign against Carter in part on the charge that the treaty was flawed, and that Carter had allowed a dangerous weakening of U.S. offensive strength.

That summer, Reagan went to NORAD headquarters in Colorado with Anderson, a senior fellow at the Hoover Institution at Stanford University, who recalls that they were shown the big screens that track movements along the U.S. coast.

Later, in a discussion with Gen. Jim Hill, then commander-in-chief of NORAD, Anderson recalls Reagan's question. Reagan was "struck by the fact that we were helpless," he said.

Hill, who has since retired, said recently that the Strategic Defense Intitiative "is exactly the kind of thing we were talking about at the time," but it was not a detailed proposal.

Reagan later told author Robert Scheer, "I think the thing that struck me was the irony that here, with this great technology of ours, we can do all this yet we cannot stop any of the weapons that are coming at us."

Returning to California in August 1979, Anderson wrote a series of policy memos for Reagan's campaign. "Memorandum No. 3" was on foreign and defense policy. It probably would have caused a sensation had it been made public at the time, when Reagan still was tagged by many as a hawkish, extreme Republican.

Anderson said Reagan had three options in his campaign.

One was to stick with Carter's course, but that would be "dangerous folly," he said. A second would be to "match the Soviet buildup," but that had "serious problems" because the public debate could "frighten as many people as it consoles," he said. A big increase in offensive missiles would be "a powerful, emotional issue to deal with politically, especially by Reagan," he wrote.

But Anderson, in a prescient passage, discussed the option of a "protective missile system." Seven years after the ABM treaty, Anderson said "perhaps it is now time to seriously reconsider" the antiballistic missile concept.

He wrote that such an idea "is probably fundamentally far more appealing to the American people than the questionable satisfaction of knowing that those who initiated an attack against us were also blown away." Anderson said the antimissile system, along with a military buildup and the MX missile, "might go a long way toward establishing the kind of national security that will be necessary in the 1980s."

Reagan privately got a similar message from another quarter that summer. Sen. Malcolm Wallop (R-Wyo.) had written a lengthy article for Strategic Review saying "it is high time we lay the phantom of MAD to rest" and turn to antimissile defense. Wallop gave a copy of the article, in typescript, to Reagan, who returned it with notations. Wallop and Reagan also discussed the ideas at a barbecue hosted by Sen. Paul Laxalt (R-Nev.), according to one informed source. Reagan told Wallop he wanted to make strategic defense an issue in the campaign, the source said. But when Wallop's staff later tried to pass along some material to Reagan assistant Michael K. Deaver, they were rebuffed, he said. (Deaver did not return a call last week.)

According to several officials, Reagan's political advisers had winced at the thought of their candidate talking about lasers in space, antimissile systems, or a change in nuclear doctrine.

John Sears, then the campaign manager, said recently that he was uncertain whether anyone would defend Reagan if he brought up the idea at the time, but he was very certain that Carter administration Defense Secretary Harold Brown, among others, would attack Reagan.

"Even those who thought it warranted looking into were not ready to vouch for its viability," he said of the strategic defense concept.

In 1979, Reagan confronted a related problem: how to respond to the "racetrack" basing mode picked by Carter for the MX missile, which was designed to offset Soviet gains in highly accurate missiles. At a meeting at the Atlanta airport called primarily to discuss the MX, a breach erupted among Reagan's defense policy advisers.

Many of them had come out of the Team B experience convinced of the need for a major offensive buildup. These included William R. Van Cleave, a professor of international relations at the University of Southern California. But a maverick, Daniel O. Graham, a retired Army lieutenant general, who also served on Team B, called the MX a "Rube Goldberg" contraption. "I said, 'Don't touch it,' " Graham recalls, urging Reagan instead to seek a "technological end-run" around the Soviets with strategic defense.

But Graham was not heeded. Reagan's campaign was devoid of rhetoric about strategic defense.

However, the 1980 GOP platform called for "vigorous research and development of an effective antiballistic missile system . . . . " The 1972 ABM treaty, which permitted each superpower one ABM system, attempted to curb further expansion of such systems. Wallop also was pursuing it actively, along with a key assistant, Angelo M. Codevilla. They invited four aerospace industry engineers to a Capitol luncheon with a dozen senators on Dec. 12, 1979, sparking congressional interest in strategic defense.

For the first two years of his presidency, Reagan focused on the modernization of offensive weapons: the B1 bomber, the MX, the Trident submarine.

But others continued to advance the concept of strategic defense, including the Heritage Foundation, and Graham put together a study on the topic called "High Frontier."

Reagan also talked about it with a group of "kitchen cabinet" friends, including industrialist Jacquelin Hume; brewer Joseph Coors; William Wilson, ambassador to the Vatican, and Karl R. Bendetsen, retired chairman of Champion International.

In 1982, Edward Teller, the nuclear physicist, met with Reagan to discuss strategic defense and other topics. Reagan "was pretty incisive in his questioning of Teller about this defense theory and spoke about it frequently, in parenthetical remarks," recalls William P. Clark, who was then Reagan's national security affairs adviser.

But it had not yet become a Reagan administration priority. Six days after Teller met with the president, a top Pentagon official, Richard D. DeLauer, was asked in a Senate hearing if he anticipated the United States getting involved in a space-based missile defense system.

"Not at this time, no," he replied.

That changed dramatically within six months. The 'Moral Imperative'

The MX missile was in serious trouble in Congress. The Joint Chiefs of Staff recently had started meeting every three months with Reagan, who got along well with the new chairman, Gen. John W. Vessey Jr.

According to a well-placed White House official who asked not to be identified, the Joint Chiefs concluded that "this is probably the last missile this Congress is ever going to go for. They were frustrated. They weren't sure they would get the MX and they knew they couldn't get anything after MX. So they said, 'We've got to look beyond MX.' "

George A. Keyworth II, the White House science adviser, said there was also concern over the continuing Soviet missile buildup. "It wasn't a political problem," he said. "The problem is a serious military problem: erosion in stability.

"The stability was going in a single direction: erosion," Keyworth said. "Prospects for the future looked tougher, more difficult, gave the president more concern."

The climax occurred at the Feb. 11 meeting with the military chiefs, Defense Secretary Caspar W. Weinberger and then-deputy national security affairs adviser Robert C. McFarlane. Reagan seized on the strategic defense concept. Although it was just one of several possible directions the Joint Chiefs discussed, Reagan devoted much of the meeting to it, and McFarlane also "jumped on it," the official said.

A crucial voice was Adm. James D. Watkins, chief of naval operations, who argued a "moral imperative" compelled Reagan to abandon the old doctrine of mutual assured destruction. Another argument that caught Reagan's attention was the opinion voiced by the military chiefs that technology had improved and made it worthwhile to go ahead with research on defensive systems, the White House official said.

Reagan was soon to give another nationally televised "threat speech," as aides called it, seeking support for the MX missile and the defense budget. Political advisers under then-White House chief of staff James A. Baker III were preparing an all-out offensive centered on the speech.

Rival national security affairs advisers were secretly, and separately, at work on what they called "MX-plus." McFarlane drafted the language for a speech insert, working with another National Security Council staff official, Adm. John Poindexter.

Ironically, once Reagan had given the green light, "the first group we had to get on board was the Joint Chiefs," the White House official said. "It was one thing to have the philosophy, it was another to have the secretary of defense and others go forward with it."

"A number of people at the Pentagon tried to sabotage it," said the official, out of fear it would divert attention from the MX and the defense budget.

The text was kept secret from all but a few aides, however. Some of Baker's associates, including then-White House communications director David R. Gergen, only saw the speech "insert" at 11 a.m. the morning of March 23, 1983.

Two days later, Reagan was asked at a news conference why he proposed the missile defense system when he did.

"I put it out now because what better time?" he said.

It is "inconceivable to me," Reagan added, "that we can go on thinking down the future, not only for ourselves and for our lifetime, but for other generations, that the great nations of the world will sit here, like people facing themselves across a table, each with a cocked gun, and no one knowing whether someone might tighten their finger on the trigger."

"There is another way . . . . "