On the eve of its 40th anniversary, the Islamic Republic of Iran faces an uncertain future. The nation is grappling with rising protests, strikes, acts of civil disobedience and an aging supreme leader, Ayatollah Ali Khamenei, who is rumored to have cancer. While the last of these might seem like the least significant, the illness of a previous Iranian leader had an oversize impact on the political direction of the country and its relationship with the United States.

Forty years ago, the United States made the mistake of not knowing about the deteriorating health of Shah Mohammad Reza Pahlavi. Failure to know that the shah was dying from cancer led to blunders in American policy, causing Washington to engage in a diplomatic course that did little to keep its staunch ally from being overthrown and replaced by a regime that has remained implacably hostile to the United States ever since. Prior behavior indicates that, had it known of the shah’s condition, the United States might have moved more aggressively to stabilize his health and keep him in power, a move that would have had dramatically different consequences for the United States.

It is therefore crucial that American intelligence have a good sense of Khamenei’s condition, lest American policymakers be surprised again in a critically important strategic region.

In 1979, the shah’s cancer played a critical role in his decision to capitulate to his opponents’ demands that he leave Iran, a seminal moment in the course of the Islamic Revolution. It caught the American political establishment off guard. U.S. officials had not anticipated that Iran’s paramount ruler would buckle while he still maintained the support of the country’s sizable military and security apparatuses. It also had cataclysmic consequences for the United States: the establishment of anti-American Shiite theocracy at the helm of the Iranian government.

At a recent roundtable on Iran’s revolution, a leading member of President Jimmy Carter’s National Security Council underlined the fact that CIA Director Stansfield Turner and Secretary of State Cyrus Vance learned of the shah’s cancer only several months before his exodus and suggested that the administration would have more effectively responded to the unfolding crisis had it known that “the shah was dying earlier in the game.” Despite its seeming reductionism, this assumption is supported by an overlooked American intervention to medically stabilize the shah — 27 years before the 1979 revolution.

On May 10, 1951, George C. McGhee, the assistant secretary of state for Near Eastern affairs, and Allen Dulles, the CIA’s deputy director of plans, met in Foggy Bottom to discuss a deteriorating political situation in Iran. The country had descended into a protracted period of bitter partisan politics, large popular demonstrations and martial law after an attempted assassination of the shah by a communist sympathizer two years earlier. Iranian nationalists increasingly clamored to wrest control of the country’s lucrative oil industry from the British-owned Anglo-Iranian Oil Co., and the murder of an American-backed Iranian premier in January of that year had set back hopes for an amicable accommodation between Tehran and London, both strategic U.S. allies in the Cold War.

Matters went from bad to worse following Mohammad Mossadegh’s appointment to lead the country. The prime minister came to power on a populist and anti-imperialist platform that centered on nationalizing Iran’s oil industry, a promise he unilaterally carried out 10 days before the gathering in Foggy Bottom.

The Americans saw Mossadegh as an unreliable demagogue, whose eccentricities, confrontational politics and obstinacy on the oil dispute would inevitably be exploited by the Kremlin to draw Iran into the Soviet orbit. The shah’s anti-communist and pro-American credentials, on the other hand, were never in doubt. At his direction, the Iranian army had defeated the secessionist communist regimes that had taken over two of Iran’s northwestern provinces in 1946. American policymakers saw him as the best hope against a “Soviet domination” of Iran and a moderating influence in the country’s standoff with London.

But to the chagrin of McGhee and Dulles, the American Embassy in Tehran had sent word that the shah’s will to resist the rising radical elements in the Iranian government was faltering because of a mysterious illness that caused recurrent and debilitating bouts of abdominal pain. Making matters worse, the shah was considering the advice of his physicians to leave the country and seek medical care in Europe, a move the Americans believed would bolster communists and other radicals in Iran.

To avert the shah’s departure, Dulles personally traveled to New York and recruited Dr. Claude E. Forkner to carry out a secret mission in Iran to diagnose, treat and reassure the hesitant monarch. Forkner had established an intimate rapport with the usually distant shah during a routine consultation two years earlier. They had maintained an occasional correspondence, which helped Forkner gain the shah’s consent to continue his medical services and dispelled any suspicion that he was a CIA contractor. Forkner diagnosed the shah with worsening chronic appendicitis that needed surgical treatment and directed the State Department to have Frank Glenn, New York Hospital’s surgeon in chief, flown to Iran, along with his staff and medical supplies, to perform the procedure.

The move paid dividends for the United States: Following successful surgery and an uneventful recovery, the shah returned to the political fray as the Americans had hoped. But that relationship may have proved the intelligence community’s undoing. A few months after the shah’s surgery, Forkner took on Mossadegh as a patient when the premier was visiting the United States, potentially signaling that the doctor was an American intelligence asset. This may have left the shah unwilling to trust the American medical establishment, explaining why he ended his medical relationship with Forkner and largely forswore the services of American physicians for the remainder of his reign. This practice contributed to the U.S. intelligence shortfalls on his health decades later.

It is impossible to determine whether the outcome of the 1979 revolution would have changed had the Carter administration known that the shah was ill. The knowledge could have moved Washington toward a more coordinated and hands-on approach at the start of the crisis, encouraging the shah to reach an accommodation with the less radical elements of the opposition before the revolt picked up steam. But it is clear the health of Iran’s ruler played an outsize role in the country’s political trajectory, a fact that should not be overlooked by current policymakers as Iran’s potentially cancer-stricken supreme leader faces unprecedented levels of opposition and social unrest.

As commander in chief of Iran’s armed forces and vicar of the Shiite Messiah, Supreme Leader Khamenei is the ultimate arbiter over the Islamic Republic’s factionalized political system. His incapacity would escalate government infighting, unbridle the Islamic Revolutionary Guard Corps and degrade the ability of the regime to cohesively respond to internal disturbances. Washington’s readiness to respond to such an eventuality could turn a new leaf in the U.S.-Iran relationship for decades to come — and for that, the United States needs to be prepared with as much intelligence as possible.