The roots of the deepening confrontation with Iraq can be found in America's decade-long obsession with Iran.

For many years, U.S. foreign policy sought to preserve a balance of power in the Persian Gulf, source of the West's vital oil supply. In search of that balance, the United States was profoundly influenced by its emotional revulsion at Iran's behavior -- at the seizure of American diplomats as hostages 11 years ago, at the specter of Islamic fundamentalism sweeping the Arab world, at Iran's support of anti-American terrorism and the embarrassing arms-for-hostages deals with the Reagan administration.

According to many analysts and government officials, fear and abhorrence of Iran led the United States to embrace Iraq's often-brutal dictator, Saddam Hussein, as a counterweight to Iran during the eight-year war that ended in 1988.

Saddam was seen as the lesser of two evils, according to these analysts. After his months-long "strategic review," President Bush signed a secret three-page national security directive in his first year in office codifying an American policy of seeking to improve Saddam's international behavior through limited cooperation with Iraq. An effort to change the policy was considered -- and rejected -- inside the administration as recently as this spring, officials said.

Even though some officials in the administration and Congress had deep misgivings, and although there were increasingly dire warnings from Israel, Bush's policy directive was still in effect on Aug. 2, the day Saddam invaded Kuwait.

Many officials inside the administration and outside analysts are now questioning whether the United States should have paused after the Iran-Iraq war and reexamined Saddam in a more critical light. The ominous trends in Saddam's behavior were no secret. However, in retrospect, U.S. policy failed to recognize that Iran was exhausted from the war, that Iraq was in the ascendancy and that Saddam was bent on becoming an Arab superpower, according to these analysts.

This was not a simple miscalculation; it was always colored by the American experience with revolutionary Iran. Despite Saddam's pursuit of weapons of mass destruction and his gruesome human rights record, no one could argue clearly for a tilt back the other way to Iran, given the enormous trauma of the last decade and the explosive political nature of any contacts with Iran. Still fresh in the American consciousness were the agonizing symbols of the Iran-contra affair in which then-President Ronald Reagan's men secretly went to Tehran bearing a Bible and a cake in the shape of a key in a vain mission to secure the release of U.S. hostages held in Lebanon by pro-Iranian extremist groups.

Every flurry of speculation about the fate of the Beirut hostages has focused these images anew in the nation's consciousness.

The reluctance to look more critically at Saddam was also reinforced by the moderate Arab states, which opposed any tilt to radical Iran. Moreover, U.S. Middle East policy-makers were preoccupied with getting Israel to the negotiating table with Palestinians, and Iraq appeared to be taking a moderate position on the peace process. For a while, after the end of the war, even some Israeli officials felt that better relations with a more moderate Iraq could be a useful bulwark against Arab radicalism.

"I think we were so obsessed with {Ayatollah Ruhollah} Khomeini and the Islamic revolution and the hostages that we in a sense welcomed Iraq's emergence as a strong, tough, bloody-minded country that could turn its influence against Iran," said William B. Quandt, a senior fellow at the Brookings Institution. He recalled that when Iraq invaded Iran on Sept. 22, 1980, the aggression passed without serious protest from the United States because "we were so {angry} at the ayatollah."

Quandt said that as the war progressed and Iraq used poison gas, "We never really felt we could stand up to the most egregious examples . . . because in the end we still wanted to see Iran defeated. There was a willingness to swallow hard on a lot of this stuff, and a lack of concern when he emerged with the upper hand. Had we been a little more attuned to the balance of power in the region, we might have been concerned that things were out of balance."

Throughout the 1980s, trying to preserve this balance of power was a devilish problem for U.S. diplomacy. President Jimmy Carter, in his State of the Union address in 1980, one month after the Soviet invasion of Afghanistan, articulated the "Carter Doctrine": the United States would act to prevent attempts by "any outside force" to gain control in the region. When an Iraqi victory appeared possible early in the war, U.S. policy-makers worried that an Iranian collapse might lead to a breakup of the country and new opportunities for Soviet aggression. Then when an Iranian victory seemed possible, the United States feared the spread of the Iranian revolution and a threat to its friends in the region, including Kuwait, Saudi Arabia, Jordan and Egypt.

To forestall an Iranian victory, the United States began a tilt toward Iraq in 1982 that included providing billions of dollars in agricultural commodity credits, Export-Import Bank guarantees and, later, military intelligence. The State Department took Iraq off the list of nations supporting terrorism. After a hiatus of 17 years, Washington and Baghdad restored diplomatic relations in 1984. The United States began Operation Staunch to identify and halt arms shipments to Iran.

But secretly in 1985, the Reagan White House also began its disastrous flirtation with Iran, trading missiles and military spare parts for help in winning freedom for the hostages in Lebanon, an effort that contravened all of Reagan's stated principles. The balance of power loomed large once again. Attempting to explain the arms shipments to the Senate Foreign Relations Committee on Jan. 16, 1987, as the full dimensions of the scandal were becoming known, former national security adviser Robert C. McFarlane said, "To have ignored Iran, to have done nothing, while safe, would have been irresponsible."

The tilt toward Iraq continued in the 1987 U.S. decision to reflag and protect Kuwaiti oil tankers. Richard Murphy, assistant secretary of state for Middle East policy during most of the Reagan administration, said the United States never sought to dissuade France or the Soviet Union from selling arms to Iraq.

At the time of the 1988 cease-fire, many hoped that battlefield exhaustion in both Baghdad and Tehran would ease tensions in the region.

Murphy recalled that U.S. officials were apprehensive as the war came to a close that Iraq would seek to dominate the weaker Persian Gulf states, and that this question was often put to Iraqi officials. "The answer was always, 'this country has been so stretched out, so strained by the war, that we will need every scrap of energy and investment' " to rebuild its economy, he said.

"You had that on the one side, and the poisonous state of relations and this obsession with Iran on the other," Murphy said. "I think we were kind of mesmerized by the ayatollah. We remained apprehensive until the end of his life that somehow this fundamentalist philosophy he was preaching would somehow catch fire again. . . . We were obsessed with Iran."

But, he said, policy-makers had no illusions about Saddam, either. "The choice between the ayatollah and Saddam was never night and day for any of us."

Frank Gaffney, a former Reagan administration Defense Department official, said, "I think we saw the Bush administration sort of put Iraq policy on autopilot after the end of the Iran-Iraq War. What may have been appropriate in dealing with the lesser of two evils and trying to help thwart the fanatic Islamic hordes of Iran, wasn't necessarily what is appropriate when those forces have been . . . reduced in their regional significance. Consequently, there should have been an adjustment, a course correction, made toward what was still an evil element -- namely, Saddam."

Richard Straus, editor of Middle East Policy Survey, a newsletter, said that Iran remained an impediment to rethinking U.S. ties to Saddam. "In part what inhibited American policy was more than 10 years worth of incredibly bad political experiences in dealing with Iran, starting with the hostages and going through the Iran-contra scandal. So Iran falls off the map as far as offering an alternative."

At the same time, Straus said, "there was a genuine feeling Iraq was an opportunity," given its potential wealth and strategic location. Iraqi diplomats frequently promised after the war, he said, that the nation would not be an aggressor and would seek to rebuild, and U.S. policy-makers "wanted to believe it."

Once the bias toward Saddam was built into policy, Straus said, it became harder to reverse. "It's very hard to undo anything in Washington," he said. "But added to that is the difficulty if you are offering {as} an alternative . . . our bete noir, Iran."

As part of a broad review of foreign policy, the incoming Bush administration reassessed its approach to Iraq and the Persian Gulf, but the outcome was to stick with the status quo and try to work with Saddam. U.S. officials knew of and were deeply concerned about Saddam's efforts to build and acquire weapons of mass destruction, including chemical, biological and nuclear arms, but they hoped to influence his behavior.

"We could point to some modest developments on issues of concern to us," Assistant Secretary of State John Kelly told a House Foreign Affairs Committee hearing last April 26, noting that Iraq was discussing a new constitution with potentially greater recognition of human rights, had participated in two disarmament conferences on chemical weapons, and was taking a more moderate tone on the Arab-Israeli conflict.

At the same time, Kelly acknowledged other signs of trouble. A British journalist, Farzad Barzoft, was executed for alleged spying; U.S. and British customs agents foiled an apparent Iraqi attempt to smuggle capacitors for making nuclear weapons; Saddam threatened to "burn up half of Israel" with chemical weapons and officials noted the placement of missile launchers near Iraq's Jordanian border for Soviet-made Scud missiles capable of reaching Israel.

There was an internal debate in the Bush administration at this time, officials have said. Some officials wanted to change course, perhaps putting Iraq back on the State Department's terrorist list. Israeli officials had conveyed to Washington their rising alarm that Baghdad's next target would be Israel. Congress was pressing ahead with sanctions once again, but the Bush administration continued to oppose them.

Secretary of State James A. Baker III acknowledged recently that the United States and others misjudged Saddam's intentions after the war. Addressing North Atlantic Treaty Organization foreign ministers, Baker said, "Many believed, and there was reason to believe, that Iraq would close the book of war and write a new book, beginning with a chapter on peaceful relations with its neighbors." Instead, he added, "we have seen a continuous and unrelenting buildup of arms."

"I don't think we understood Iraq's postwar ambition," said Quandt. "We thought they would have to spend some time rebuilding." When Saddam poured weapons to Christian forces in Lebanon to fight his old enemy, Syria, "we missed the first sign" that he did not intend to rebuild economically, Quandt added. "They weren't looking inward. They were throwing their weight around regionally, but in a place we didn't care about. It was a warning signal."

Quandt said, "What we missed was the broader strategy he was after," which was the invasion of Kuwait. "We're kicking ourselves for not having seen it coming more clearly. Certainly by the last couple weeks of July there was a lot of evidence out there. It does seem that had we been a little more attentive to the man and the regime, once he started saying Kuwait has declared war on us and should be made to pay for this, we should have thought whether some kind of step might have been effective at that point to make him think he wouldn't get away with it scot-free. It almost seems he thought he could get away with it."