The strategic rationale for the relationship between the United States and China has collapsed. After a quarter century in which American presidents sought to integrate a rapidly developing China into the American-led international order, the United States has concluded that what it thought was a “strategic partner” is in fact a “strategic adversary.” After decades of keeping its head down following Deng Xiaoping’s injunction to “hide and bide,” Xi Jinping’s China has discarded that cloak and become increasingly assertive.

At this point, policymakers in Beijing and Washington understand that they are locked in a classic Thucydidean rivalry. China is a meteoric rising power. The United States is a colossal ruling power. As China achieves its dream to “make China great again,” it is inevitably encroaching on American positions and prerogatives at the top of every pecking order—commanding heights that after an American century, Americans have naturally come to see as their rightful place.

In the long sweep of history, when a rising power threatens to displace a ruling power, alarm bells should sound: extreme danger ahead. The past 500 years have seen sixteen similar Thucydidean rivalries. Twelve ended in war. Destined for War: Can America and China Escape Thucydides’s Trap? develops this diagnosis of the predicament leaders of the American and Chinese governments now face. As Henry Kissinger has noted, Thucydides’s Trap offers the best lens available for cutting through the noise and news of the day to the underlying dynamic in relations between these two great powers.

Must Donald Trump and Xi Jinping and their national security teams follow in the footsteps of leaders of earlier generations to war—a real, bloody, and potentially devastating World War III? Or could they become as imaginative and agile as leaders of the four cases in the past 500 years in which war was averted?

Over the three years since my manuscript went to the publisher, I’ve been searching for ways to give a positive answer to that question—in effect, to escape Thucydides’s Trap. To date, I’ve identified nine potential “avenues of escape.” Each, of course, has pros and cons. At this point, none of the viable options seems compelling.

The one that I’m now most actively exploring with both Chinese and American scholars combines an ancient Chinese concept of “rivalry partners” and an insight President John F. Kennedy came to after having survived the Cuban Missile Crisis—he called for the United States and the Soviet Union to coexist in a “world safe for diversity.” Could the current American and Chinese governments develop a twenty-first century combination of the two ideas to meet the challenges they face today? Could they manage a rivalry partnership in a world safe for diversity?

The United States’ core national interest is to “to preserve the United States as a free nation with our fundamental institutions and values intact,” as the defining statement of Cold War strategy put it. But could that goal be achieved in a world that also included an Evil Empire, as Ronald Reagan rightly called the Soviet Union? Or today, in a world with a rapidly-rising authoritarian China?

In the first chapter of the Cold War, leaders we now revere as the “Wise Men” answered “no.” George Kennan’s Long Telegram identified the Soviet Union as “a political force committed fanatically to the belief that with the United States there can be no permanent modus vivendi.” According to Kennan’s diagnosis, the Soviets “believed it was necessary that our society be disrupted, our traditional way of life be destroyed, the international authority of our state be broken, if Soviet power was to be secured.” As America’s first secretary of defense, James Forrestal, put it: Soviet Communism is “as incompatible with democracy as was Nazism or fascism.”

But after having survived the Cuban Missile Crisis in which he believed there was a one-in-three chance of a nuclear war that could have killed hundreds of millions of people, President John F. Kennedy had second thoughts. In the most significant foreign policy speech of his career, delivered just five months before he was assassinated, Kennedy signaled a major shift in American Cold War strategy. While never wavering in his conviction that the Soviet Union was evil and the U.S.-led free world good, he nonetheless concluded that an unconstrained effort to bury Soviet-led totalitarianism had become unacceptably dangerous.

Going forward, the United States and Soviet Union would have to find ways to constrain their competition and even compromise: to live and let live in a world of diverse political systems with diametrically opposed values and ideologies. In a bit of rhetorical jiu-jitsu that stood Woodrow Wilson’s longstanding call for a “world safe for democracy” on its head, he insisted that hereafter, the priority in the Cold War would be to build a “world safe for diversity.”

What led President Kennedy to such a dramatic change of mind? The experience of existential nuclear danger. He really believed that the confrontation in which he had stood eyeball-to-eyeball with the Soviet leader Nikita Khrushchev could have ended in nuclear armageddon. Having survived, as he gave thanks, he vowed that hereafter he would do everything in his power to ensure that neither he nor any of his successors would ever have to do that again. He internalized the incandescent insight Ronald Reagan later captured best in his favorite one liner: “a nuclear war cannot be won and must therefore never be fought.”

Operationally, this meant turning the page to a new chapter of the Cold War in which ruthless competition was tempered by caution, communication, explicit and implicit constraints, and even compromise. In a surge of initiatives, the Kennedy administration established a hotline between Washington and Moscow “to avoid on each side the dangerous delays, misunderstandings, and misreadings of the other’s actions which might occur at the time of crisis;” announced a unilateral moratorium on atmospheric tests of nuclear weapons to jumpstart negotiations that led within a year to the Limited Test Ban Treaty; and began negotiations that culminated in the Nuclear Nonproliferation Treaty, slowing the growth of nuclear weapons states.

The two parties also further clarified and extended what Kennedy called the “precarious rules of the status quo,” including: no use of nuclear weapons, no bullets or bombs fired by uniformed American or Soviet combatants against each other, and no surprises within the adversary’s sphere of influence. Within these parameters, the two adversaries would continue to compete vigorously on every other dimension, including demonstrating which society’s values and system of government best fulfill its objectives.

Could Kennedy’s insight offer clues for Americans and Chinese strategists today as they think about how to escape Thucydides’s Trap? Could it be enlarged and enriched by a concept of “rivalry partnership” that emerged a thousand years ago in ancient China?

Rivalry partners sounds like a contradiction. But it describes the relationship the Song Emperor of China agreed to establish with the Liao, a Manchurian kingdom on China’s northern border, after concluding that his armies would not be able to defeat them. In the Chanyuan Treaty of 1005, Song China and Liao agreed to compete aggressively in some arenas and simultaneously to cooperate intensely in others. In a unique version of Chinese tributary relations, the Chanyuan Treaty required the Song to pay tribute to the Liao, who agreed to invest that payment in economic, scientific and technical development in Song China.

Sustaining this rivalry partnership required managing recurring crises and adapting to new conditions. Nonetheless, the era of peace between the two rivals that followed lasted 120 years. Moreover, the payments created an early form of a market, stimulating economic growth in China that supported the development of arts and learning in what Chinese historians now describe as a “golden era.”

The question today is whether American and Chinese statesmen could find their way to a twenty-first century analogue of the Song’s invention—one that would allow them simultaneously to compete and cooperate.

On one side of the ledger, the two will certainly be ruthless rivals in economic production and trade, in advancing technology, developing military capabilities, forming alliances and alignments, and demonstrating how they govern their own society. But since both cultures understand competition as a significant driver of progress, this will have benefits as well as risks.

In a well-structured economic market, rivalry among entities spurs invention and the production of better goods at lower prices. As Adam Smith taught us, the combination of specialization according to comparative advantage and trade produces a larger pie than the states could make operating separately. Rivalry within a market, national or international, thus drives innovation, invention and increased prosperity. At the same time, it offers opportunities for predatory behavior, monopoly, and extortion unless embedded in agreed, enforced rules of the game.

Moreover, since GDP forms the substructure of national power, Americans rightly worry that, even in a fair economic rivalry with China, since China has four times as many people as the United States, if the Chinese turn out to be only one quarter as productive as Americans (as they are approximately today), China will have a GDP equal to the United States. If they are half as productive, twice the GDP, and so forth in an arithmetic progression that is hard to ignore.