Leon Aron is the author of “Yeltsin.” He is a senior fellow at the American Enterprise Institute and is writing a book about Vladimir Putin’s road to Ukraine and beyond.

No matter what the outcome, Vladimir Putin’s war on Ukraine spells bad news for his regime. Neither taking Kyiv and declaring victory nor beginning peace negotiations will save the Russian president from the serious, if not fatal, domestic repercussions of this war.

As the war drags on, the danger to Putin’s reign will come chiefly from three quarters: the oligarchs, the military and those whom we call “ordinary Russians.” The oligarchs, who stand to lose the most from the West’s sanctions, have been publicly cautious, whatever their true sentiments may be. Cowed since the arrest of Mikhail Khodorkovsky in 2003, some left Russia, while others appear reconciled to (in effect) managing their companies on behalf of the state rather than being their masters. Of the four who have registered concerns so far, three did so from London — Mikhail FridmanRoman Abramovich and Oleg Tinkov. Only one, Oleg Deripaska, made a comment from Moscow. All point to the tragedy of the war and call for peace without blaming Putin. Only Tinkov explicitly said that he opposes the war.

Throughout Russian history, the military has generally stayed away from politics (with the notable exception of the hapless Decembrist revolt in 1825). Like other autocrats, Putin has had ample opportunity to choose his top officers for loyalty rather than capability. His minister of defense, Sergei Shoigu, has no military background at all: He is a civil engineer who was minister of emergency situations when Putin put him in charge of the country’s armed forces.

Thousands of ordinary Russians have already been arrested for protesting the war. But the majority of citizens are almost certain to rally around Putin at first, as they did after Putin’s first attack on Ukraine in 2014. He is clearly hoping that this effect will last until the March 2024 presidential election, when, at 71, he will likely try to embark on a presidency for life. It is impossible to predict when the memories of the Soviet Union’s quagmire in Afghanistan — the zinc-lined coffins and the unmarked graves — will result in resentment, then anger, then mass protests.

It is for just such an eventuality that Putin set up the national guard, under his former bodyguard Viktor Zolotov, in 2016. Borrowing from the police and entirely absorbing the former special riot troops (known as the OMON), the guard, which in the past six years has grown to an estimated 200,000 to 400,000 men, is supposed to be utterly loyal to the Kremlin. However, it is one thing to bash the heads of students in Moscow and St. Petersburg, and another to shoot at the mothers of soldiers killed in Ukraine. If the guardsmen hesitate, the military will not come to Putin’s rescue, while the oligarchs might be emboldened enough to donate to the protesters, as their Ukrainian counterparts did during the Orange Revolution of 2004 and the Maidan Revolution of 2014.

The Russian national tradition is unforgiving of military setbacks. Virtually every major defeat has resulted in radical change. The Crimean War (1853-1856) precipitated Emperor Alexander II’s liberal revolution from above. The Russo-Japanese War (1904-1905) brought about the First Russian Revolution. The catastrophe of World War I resulted in Emperor Nicholas II’s abdication and the Bolshevik Revolution. And the war in Afghanistan became a key factor in Soviet leader Mikhail Gorbachev’s reforms.

It’s also worth noting that the current regime is uniquely vulnerable on this account. More than any other Russian ruler, Putin has made war, or the threat of war, the foundation of his popular support. He began his presidency by promising economic modernization, but when growth slowed and then began to stall, he shifted his tactics to what Russian scholars have called “patriotic mobilization” or “militarized patriotism in peacetime.” Russian propaganda soon began stressing two main themes: The “West” is at war with Russia. An undeclared, mean, constant war. But the Motherland has nothing to worry about so long as Putin is in charge. Not only will he protect Russia, but he will also restore it to at least some of the victorious glory of the Soviet superpower status.

Compared with Marxism-Leninism, Putin’s national ideology of militarized patriotism lacks coherence and is yet to be tested by adversity. As to the terror, the evolution of the regime from a still “softer” authoritarianism to a traditional brutal dictatorship will be one of the most troubling consequences of this war. Wartime censorship has already started, with huge fines and up to 15 years in jail for “distorting the purpose, role and tasks of the Armed Forces,” arrests are piling up, and more repression is likely to follow. Yet after two decades of incomplete and steadily diminishing but real freedoms, a sudden switch to near-totalitarianism carries enormous risks for Putin.

Every day that Ukraine holds out erodes Putin’s regime. The consequences could be far-reaching.