A demonstrator in Istanbul holds a picture depicting Vladimir Putin during a protest against Russian military operations in Syria. It reads in Turkish and Russian: “Murderer Putin.” (Associated Press)

What Russian President Vladimir Putin does next, after sending a limited number of his aircraft and some military units into Syria to shore up support for Syrian President Bashar al-Assad, will show what he learned from the Soviet Union’s own disastrous 1979 invasion of Afghanistan.

On the other hand, President Obama’s actions in Syria demonstrate that he has learned from Iraq and Afghanistan, lessons that Americans should have absorbed almost 40 years ago from Vietnam.

“Unless we can get the parties on the ground to agree to live together in some fashion, then no amount of U.S. military engagement will solve the problem,” was the way Obama on Friday described what he had learned.

To those who call for a more active military role in Syria, Obama warned: “We will find ourselves either doing just a little bit and not making a difference and losing credibility that way, or finding ourselves drawn in deeper and deeper into a situation that . . . we can’t sustain.”

That is why Obama predicted that “an attempt by Russia and Iran to prop up Assad and try to pacify the population is just going to get them stuck in a quagmire, and that it won’t work. And they will be there for a while if they don’t take a different course.”

Of course, Obama’s critics don’t see it that way.

Last Wednesday in a Senate-floor speech, Sen. John McCain (R-Ariz.) described the Obama administration’s Syria policy as having “mistaken an excess of caution for prudence and replaced the risk of action with the perils of inaction.”

McCain added, “Into the wreckage of this administration’s Middle East policy has now stepped Vladimir Putin.”

But it is Putin whose Syrian policy faces wreckage. As in 2014, when Putin backed the ousted then-President of Ukraine Viktor Yanukovych, the Russian leader is attempting to keep in power another inevitable loser, Assad.

Moscow’s support for the Assad family dictatorial rule over Syria goes back to the Cold War when Damascus allied itself with the Soviet Union.

When in 1971 Hafez al-Assad, the current president’s father, led a coup and took control of the Syrian government, he signed a security pact with Moscow. In return, Assad gave the Soviets a naval base at Tartus, to this day Moscow’s only port on the Mediterranean Sea through which Russian arms have flowed to Syria for decades. The Kremlin over the years has provided more than $2.5 billion in military assistance to Damascus.

Since the revolt against the Assad regime began in the spring of 2011, Americans have been focused on Obama’s early statement that “the time has come for President Assad to step aside.” Less publicized was what was said immediately afterwards: “The United States cannot and will not impose this transition upon Syria. It is up to the Syrian people to choose their own leaders, and we have heard their strong desire that there not be foreign intervention in their movement.”

Putin, however, from the beginning supported the Assad regime, with Russia blocking the first two United Nations resolutions in May and June 2011 that condemned the Syrian government for its use of brutal force against its own civilians. Since then, Russia has continued to supply military advisers and arms to the Syrian regime, including Russian Mi-8 and Mi-17 helicopters that carry out barrel-bomb attacks.

Despite that aid, the Assad regime has been losing ground to rebel military units that include both pro- and anti-American Sunni and jihadist groups — among them, the Islamic State and pro-al Qaeda fighters.

By early September, according to the nonpartisan Institute for the Study of War (ISW), the Syrian regime had lost control of much territory in the northwestern regions of the country, which is not only the home territory of the Assad family, but also the Russian navy base.

One problem for Assad is that the Syrian army suffers “from persistent shortages of manpower due to overstretch, attrition and endemic draft evasion that have increasingly led the regime to rely upon fighters from Iranian proxy groups such as Lebanese Hezbollah,” according to the ISW. Remember, Syria is 70 percent Sunni while Assad and his top colleagues are Alawites, a branch of Shia Islam.

The potential military collapse of Moscow’s only Arab ally has forced Putin to step in with Russian air units and ground forces to protect Assad.

“Mr. Putin had to go into Syria, not out of strength but out of weakness, because his client Mr. Assad was crumbling and it was insufficient for him simply to send them arms and money,” Obama correctly said.

And despite what Obama’s critics say, Putin is hardly acting from strength. What has also gotten little publicity in the United States are Putin’s financial troubles at home.

The drop in world oil prices plusUnites States and European Union sanctions in the wake of Putin’s takeover of Crimea and military push into eastern Ukraine are expected to shrink Russia’s gross domestic product this year by 3 percent.

The Russian finance ministry has proposed reducing the annual increase in government pensions over the next three years to 5 percent while the country’s inflation rate is above 15 percent.

Amazingly, Donald Trump may be the only GOP presidential candidate to get it right, when he predicted on NBC’s “Meet the Press”: “I’m not just justifying Putin. But you watch, he’ll get bogged down there. He’ll be there. He’ll spend a fortune. He’ll be begging to get out.”

For previous Fine Print columns, go to washingtonpost.com/fedpage.