President Obama speaks at the final news conference at the end of the NATO summit in Warsaw on July 9. (Pawel Supernak/European Pressphoto Agency)

THE SHADOW cast over the West by Britain’s vote to exit the European Union will not be dispelled anytime soon. But a summit of the NATO alliance in Warsaw over the weekend provided a ray of light. By ratifying decisions to deploy forces in Eastern Europe to deter Russian aggression and extend the military mission in Afghanistan, NATO and its leaders confirmed that their defense cooperation remains functional and able to respond to new challenges. It was a demonstration that surely disappointed Russian President Vladi­mir Putin — and ought to be instructional for presumptive Republican presidential nominee Donald Trump.

Not without reason, President Obama called the Warsaw decisions “the most significant reinforcement of collective defense any time since the Cold War.” NATO will send four battalions of 800 to 1,200 troops to four countries: Poland, Latvia, Lithuania and Estonia. Another four battalions will be based in Romania and Bulgaria. Mr. Obama announced that the contingent in Poland will be U.S. troops, while Britain will deploy troops to Estonia and Germany to Lithuania.

The new troops are a tangible response to Russia’s invasion of Ukraine and its increasingly provocative exercises and air maneuvers near the Baltic states, which once were part of the Soviet Union. While a battalion wouldn’t stop a Russian invasion, it will provide a tripwire that could deter impulsive and opportunistic adventures by Mr. Putin — as the invasions of Crimea and eastern Ukraine appeared to be.

Similarly, the commitment to extend NATO’s mission in Afghanistan in 2017 — made possible by Mr. Obama’s decision not to go forward with a drastic drawdown of U.S. troops — was badly needed to sustain the still-fragile Afghan government. The Taliban movement, which had been hoping to wait out a Western withdrawal, may now give greater consideration to peace talks. A deal to provide funding to the Afghan army through 2020 should further bolster and stabilize Kabul.

Mr. Putin, who cheered the Brexit vote and hoped for a split within the West, will have to witness the deployment of more NATO troops to his borders as well as the renewal of Western economic sanctions linked to Ukraine; prodded by the Obama administration, the European Union renewed its version of the measures last month. Moscow could respond with its own military exercises and patrols. But it has already been provocatively prodding its NATO neighbors for years. Now it will face a more determined response.

The common stand is not without discord: France and Italy questioned the sanctions renewal, while Germany’s foreign minister objected to Western military exercises in Poland, calling them “saber-rattling.” NATO’s new commander, U.S. Gen. Curtis Scaparrotti, still has to work out where exactly to station the new troops; he must strike a balance between deterring Russia and lessening the chance of accidents and incidents.

For now, however, the trans atlantic alliance is looking slightly firmer than it did the day after the British vote. NATO has shown that it can still bind Britain, most European Union nations and the United States and Canada on key security issues — as long as it is not itself undermined by demagogues. We don’t really expect Mr. Trump to take a lesson from this, but American voters should.