FOR FIVE YEARS, President Obama has led a foreign policy based more on how he thinks the world should operate than on reality. It was a world in which “the tide of war is receding” and the United States could, without much risk, radically reduce the size of its armed forces. Other leaders, in this vision, would behave rationally and in the interest of their people and the world. Invasions, brute force, great-power games and shifting alliances — these were things of the past. Secretary of State John F. Kerry displayed this mindset on ABC’s “This Week” Sunday when he said, of Russia’s invasion of neighboring Ukraine, “It’s a 19th century act in the 21st century.”

That’s a nice thought, and we all know what he means. A country’s standing is no longer measured in throw-weight or battalions. The world is too interconnected to break into blocs. A small country that plugs into cyberspace can deliver more prosperity to its people (think Singapore or Estonia) than a giant with natural resources and standing armies.

Unfortunately, Russian President Vladimir Putin has not received the memo on 21st-century behavior. Neither has China’s president, Xi Jinping, who is engaging in gunboat diplomacy against Japan and the weaker nations of Southeast Asia. Syrian president Bashar al-Assad is waging a very 20th-century war against his own people, sending helicopters to drop exploding barrels full of screws, nails and other shrapnel onto apartment buildings where families cower in basements. These men will not be deterred by the disapproval of their peers, the weight of world opinion or even disinvestment by Silicon Valley companies. They are concerned primarily with maintaining their holds on power.

Mr. Obama is not responsible for their misbehavior. But he does, or could, play a leading role in structuring the costs and benefits they must consider before acting. The model for Mr. Putin’s occupation of Crimea was his incursion into Georgia in 2008, when George W. Bush was president. Mr. Putin paid no price for that action; in fact, with parts of Georgia still under Russia’s control, he was permitted to host a Winter Olympics just around the corner. China has bullied the Philippines and unilaterally staked claims to wide swaths of international air space and sea lanes as it continues a rapid and technologically impressive military buildup. Arguably, it has paid a price in the nervousness of its neighbors, who are desperate for the United States to play a balancing role in the region. But none of those neighbors feel confident that the United States can be counted on. Since the Syrian dictator crossed Mr. Obama’s red line with a chemical weapons attack that killed 1,400 civilians, the dictator’s military and diplomatic position has steadily strengthened.

The urge to pull back — to concentrate on what Mr. Obama calls “nation-building at home” — is nothing new, as former ambassador Stephen Sestanovich recounts in his illuminating history of U.S. foreign policy, “Maximalist.” There were similar retrenchments after the Korea and Vietnam wars and when the Soviet Union crumbled. But the United States discovered each time that the world became a more dangerous place without its leadership and that disorder in the world could threaten U.S. prosperity. Each period of retrenchment was followed by more active (though not always wiser) policy. Today Mr. Obama has plenty of company in his impulse, within both parties and as reflected by public opinion. But he’s also in part responsible for the national mood: If a president doesn’t make the case for global engagement, no one else effectively can.

The White House often responds by accusing critics of being warmongers who want American “boots on the ground” all over the world and have yet to learn the lessons of Iraq. So let’s stipulate: We don’t want U.S. troops in Syria, and we don’t want U.S. troops in Crimea. A great power can become overextended, and if its economy falters, so will its ability to lead. None of this is simple.

But it’s also true that, as long as some leaders play by what Mr. Kerry dismisses as 19th-century rules, the United States can’t pretend that the only game is in another arena altogether. Military strength, trustworthiness as an ally, staying power in difficult corners of the world such as Afghanistan — these still matter, much as we might wish they did not. While the United States has been retrenching, the tide of democracy in the world, which once seemed inexorable, has been receding. In the long run, that’s harmful to U.S. national security, too.

As Mr. Putin ponders whether to advance further — into eastern Ukraine, say — he will measure the seriousness of U.S. and allied actions, not their statements. China, pondering its next steps in the East China Sea, will do the same. Sadly, that’s the nature of the century we’re living in.