Thirty years ago last week, the fall of the Berlin Wall transfixed the world, heralding not only the liberation of communist East Germany, but the crumbling of the entire Soviet empire, which collapsed two years later on Christmas day, 1991. Thus ended the long and terrifying Cold War, with a victory for America and its democratic allies — and without the global conflagration long feared.

Today, it is tempting — though misleading — to look back on the peaceful dismantling of the Berlin Wall as part of some evolutionary process in which tyrannies naturally implode and freedom triumphs. That was the trajectory many hoped for as the dust settled on the Soviet collapse. For a giddy interlude, there were grand prophecies of a global golden age, the end of history, an Elysian new era of democracy, liberty and justice for all.

A generation later, that was still the vision invoked by President Barack Obama, who premised much of his foreign policy on the idea that America could afford to hang back and watch while waiting for the long arc of history to bend toward justice. During his 2008 presidential campaign Obama visited Berlin, and, speaking before the Brandenburg Gate, he described the fate of the wall as if it had been some phenomenon of nature, an event in which even the wall itself had perhaps cooperated: “A wall came down, a people came together and history proved there is no challenge too great for a world that stands as one.”

Unfortunately, the triumph of freedom has never been that easy. Even in November of 1989, as Germans joyously tore down the wall, the world was far from standing as one. While the celebrations were in full swing in Berlin, I spent some time in Beijing, home to Asia’s chief legacy of Lenin’s 1917 communist revolution. In China, the atmosphere was anything but festive. People were in shock over the slaughter that June with which China’s Communist Party had obliterated the democracy protests centered in Beijing’s Tiananmen Square.

In the aftermath of the Cold War, America engaged liberally for decades with both Russia and China in the hope that via aid and trade the U.S. could also export its values; that systems of liberty and justice could hitch a ride on friendly diplomacy and commerce. As it turned out, the governments of both Russia and China were delighted to exploit many of the resources the Free World had to offer — especially its rapidly advancing technology — but harbored their own plans to cultivate and export a rather different set of systems and values.

Today, Lenin’s heirs in both Moscow and Beijing have jettisoned the worst economic inefficiencies of communism, but they have adapted and enhanced via technology their methods of control at home and their reach abroad. Both presidents Vladimir Putin in Russia and Xi Jingping in China regard freedom and democracy as threats to their power. They have embarked on far-ranging campaigns for influence and turf. Whatever their differences, they are cooperating these days in their shared antagonism toward the U.S., and they are flanked by an array of malign sidekicks including the tyrannies of Iran and North Korea.

Of prime concern is China, now the world’s second-largest economy but a totalitarian state complete with a gulag, pervasive surveillance, and a ruling party churning out clouds of propaganda while censoring inbound information via the Chinese internet’s Great Firewall. China’s 66-year-old dictator, Xi Jinping, having effectively installed himself as tyrant for life, aspires to turn China into the world’s dominant power. To this end, he has been directing resources into an enormous military buildup, territorial grabs in the South China Sea, acquisition of foreign port facilities that could double as naval bases and massive campaigns of influence abroad. Xi’s project is to impose his totalitarian “China Dream” as the basis of a new world order.

In the face of this, it is vital to understand the real lesson of the Berlin Wall. Yes, when the wall finally fell, it came down like a house of cards. But what paved the way for its disintegration was a strategy conceived years earlier by President Ronald Reagan, who made it his driving mission not to appease and accommodate the USSR, but to defeat it.

In 1977, three years before winning the presidency, Reagan told his strategy to Richard V. Allen, who went on to became his first national security adviser. As Allen recounted in an article published in 2000 by the Hoover Digest, Reagan warned that because his strategy was simple, some would call it simplistic. Then he said: “It is this: We win and they lose.”

Allen, in his Hoover article, comments: “One had never heard such words from a major political figure; until then, we had thought only in terms of managing the relationship with the Soviet Union.”

Reagan pursued his strategy on many fronts during his two terms in the White House. In his 1982 State of the Union address, Reagan explained that along with proposing to the USSR “a far-reaching agenda for mutual reduction of military forces,” he wanted to put in place “A real incentive for the Soviets to take these talks seriously.” Laying out his basic plan, Reagan said:

“A recognition of what the Soviet empire is about is the starting point. Winston Churchill, in negotiating with the Soviets, observed that they respect only strength and resolve in their dealings with other nations. That’s why we’ve moved to reconstruct our national defenses. We intend to keep the peace. We will also keep our freedom.”

In 1983, Reagan gave his famous “evil empire” speech, in which he spelled out that the struggle between the U.S. and the USSR was not a disagreement between equals but a contest between “good and evil.” Among America’s policy elite, Reagan was widely condemned at the time as a warmonger, a crazy Hollywood actor trying to insert religious views of morality into politics. The late historian Henry Steele Commager denounced Reagan’s remarks as “The worst presidential speech in American history.” Reagan stuck to his strategy, rebuilt the U.S. military and effectively challenged the Soviet Union, with its rotting communist economy, to an arms race it could not win.

Demolishing the Berlin Wall was among Reagan’s specific goals. Allen, in his Hoover Digest article, describes a visit Reagan made to Berlin in 1978, while still governor of California. Standing before the concrete monstrosity of the wall, Reagan told Allen and another adviser, “We have got to find a way to knock this thing down.”

Nine years later, when Reagan as president revisited that wall, he included in his speech a phrase that prudent diplomats had urged him to delete, lest it anger the Kremlin: “Mr. Gorbachev, tear down this wall.” In that same speech, Reagan laid out exactly what that wall signified:

“Behind me stands a wall that encircles the free sectors of this city, part of a vast system of barriers that divides the entire continent of Europe. From the Baltic, south, those barriers cut across Germany in a gash of barbed wire, concrete, dog runs and guard towers. Farther south, there may be no visible, no obvious wall. But there remain armed guards and checkpoints all the same — still a restriction on the right to travel, still an instrument to impose upon ordinary men and women the will of a totalitarian state.”

Reagan left office in January 1989, with the stage set for victories that had seemed impossible when he first entered the White House. Ten months later, with the Soviet Union on the ropes, Soviet President Mikhail Gorbachev declined to dispatch military forces to shore up an East German regime increasingly beset by its own people’s demands for freedom. On Nov. 9, 1989, the Berlin Wall fell.

Replicating such victories today is anything but easy. America is much absorbed in its own domestic quarrels. But under President Donald Trump, America has at least begun the vital project of rebuilding its military, and for the first time in generations has been pushing back against China’s increasingly predatory and dangerous tyranny — and not only on crooked trade practices. On Oct. 30, Secretary of State Michael Pompeo gave a speech in which he called out China’s ruling Communist Party as “a Marxist-Leninist Party focused on struggle and international domination.” Pompeo went on to warn that China’s regime is offering to both its own people and the world a form of governance “in which a Leninist Party rules and everyone must think and act according to the will of the Communist elites.”

What to do about this? For anyone — whether Trump or his critics — who aims to protect America from the totalitarian perils now amplifying in the 21st century, it’s worth recalling the guiding strategy with which Reagan took down the worst threat of his own time: We win, they lose.