During his annual news conference on Dec. 23, Russian President Vladimir Putin railed against NATO enlargement. “How would the U.S. react if we delivered rockets near their borders with Canada or Mexico?” he pointedly asked.

Putin’s increasingly combative rhetoric, coupled with Russia’s recent huge troop buildup on its border with Ukraine (which it has since drawn down) caused concern that the Kremlin was readying an invasion to pull the country back into Russia’s sphere of influence and prevent its accession to NATO.

But war was and is hardly foreordained, given the costs that Russia could face if it invaded its neighbor. Although Ukraine’s military forces are still no match for Russia’s, they would be far better at defending the country than they were in 2014, when Russia grabbed Crimea and intervened in the eastern Donbas region to support pro-Russian separatists. Russian aggression has alienated most Ukrainians, making widespread popular resistance likely if Russia tries to seize a major chunk of the country. Putin can expect not only heavy Russian casualties, but also the severe economic sanctions that the United States and its European allies are currently weighing.