Here’s the central dilemma of the Ukraine invasion: This is a war Russian dictator Vladimir Putin believes he “cannot afford to lose” (in the words of U.S. Director of National Intelligence Avril Haines), but it’s also one he cannot seem to win. It took U.S. troops only three weeks to take Baghdad in 2003. But the Ukraine war is now almost three weeks old, and Putin is as far as ever from his stated objectives of “demilitarization and denazification,” meaning the imposition of a Russian puppet regime in Ukraine.

His best bet was a blitzkrieg toward Kyiv in the war’s early days. But that fizzled out, and the Russian army hasn’t shown the ability to consistently supply its armored columns or coordinate air and ground operations. The Russians have made better progress in the south than the north, but their advance is now stalled, and they still can’t dominate the skies. The Ukrainians have mounted a skillful and dogged defense — a military task that is inherently easier than conducting an offensive.

The Russian army is trying to make up for its lack of military skill with sheer brutality. It is pounding Mariupol and Kharkiv into rubble, deliberately targeting civilians just as it once did in Aleppo, Syria, and the Chechen capital of Grozny. Kyiv’s turn is likely next. Putin might even use chemical weapons. But such brutality can often boomerang by leading to stiffer resistance.

Note that Russia’s ally Bashar al-Assad still hasn’t snuffed out Syria’s rebellion nearly seven years after Russia’s intervention despite (or because of) all the regime’s atrocities. Or consider how Leningrad withstood a German siege of nearly 900 days from 1941 to 1944. That’s a story Putin should know well since Leningrad, now called St. Petersburg, is his hometown, and his brother died in the siege. The population starved but did not surrender.

Demolishing a city with artillery and rockets is easy; occupying it is much harder. Rubble creates fighting positions for defenders and impedes movement by armored vehicles. It took Iraqi forces, supported by the U.S. military, nine months from 2016 to 2017 to retake Mosul from only about 6,000 Islamic State fighters. Is Putin willing to wait for a lengthy siege of Kyiv while sanctions continue to hammer the Russian economy and the body bags keep coming home?

U.S. officials conservatively estimate that Russia lost 5,000 to 6,000 soldiers in the first two weeks of the war — or roughly 400 a day. (The real figure might be as high as 700 a day.) Those are the kind of combat losses Russia has not suffered since 1945. In Afghanistan, the Soviets averaged about five soldiers killed in action a day, and even that was enough to undermine the regime. Putin is already feeling the strain — he is trying to recruit Syrian mercenaries and allegedly asking China for military equipment. Those are signs that he does not have enough soldiers or weapons to make up for heavier-than-expected losses in a war that is not going according to plan.

Eventually the Russians might be able to batter their way into Kyiv. They might even be able to kill or capture Ukraine’s courageous president, Volodymyr Zelensky. But that would still not win the war. The free Ukrainian government could simply relocate to Lviv, in western Ukraine, or Poland and continue to rally resistance.

Putin has nowhere near enough troops in Ukraine — fewer than 190,000, according to estimates — to control a country of more than 43 million people. In eastern Ukraine and Syria, Putin preferred to delegate the dirty work of ground combat to local allies. But there is little prospect of recruiting a pro-Russian security force in the rest of Ukraine. Even Ukrainians who were once friendly to Moscow are now consumed by hatred for Russia. Anti-Russia protests continue under the guns of the occupiers.

In my book “Invisible Armies: An Epic History of Guerrilla Warfare From Ancient Times to the Present,” I concluded that scorched-earth counterinsurgency works only when the guerrillas are weak and cut off from outside assistance and the counterinsurgents have overwhelming numbers and political legitimacy. All of those conditions applied in Chechnya, Putin’s first war. But not a single one of them applies in Ukraine, any more than in 1980s Afghanistan. Putin is making life hell for Ukrainian civilians, but Ukrainian fighters supplied by the West can make life hell for Russian troops for years to come — and it will take more than a few missile strikes to cut Ukraine’s supply lines from its NATO neighbors.

Ultimately what convinces me that Russia cannot win is Napoleon’s maxim: “In war, moral power is to physical as three parts out of four.” The Russians might have more materiel, but the Ukrainians have a decisive moral — and morale — advantage. While Ukrainians are desperately fighting for their homeland, many Russian troops weren’t told where they were going and are surrendering at the first opportunity.

If Putin wants to avoid a lengthy quagmire, sooner or later he will need to moderate his maximalist objectives and end this evil war. The only sensible way out is to accept defeat while calling it a victory. Luckily for him, he’s a practiced prevaricator. The big danger is that Putin might not be entirely rational when it comes to Ukraine. Thus he might continue trying to win the unwinnable war at a terrible cost for both sides.