Last weekend in the Middle East, a new wave of chaos swept across the border between Israel and Syria. On Saturday, Iranian forces flew a drone into Israel’s airspace. In retaliation, Tel Aviv attacked the air base near Palmyra from which it had been launched. When Syria’s anti-air systems sought to protect the Iranians, downing one Israeli F-16, they were mauled. Russia, which intervened in the Syrian civil war in 2015 to aid President Bashar al-Assad, had deployed advanced S-400 missile defense systems to his ally. This time, they did nothing to intervene. Moscow seemed willing to let Israel give Iran a bloody nose to warn Assad against aligning himself too closely with Tehran—a double win of sorts.

Putin probably needed it. On February 7, the Syrians tried to take the Conoco oil fields near Deir ez-Zor from Syrian Defense Forces rebels. They started with an attack on a facility where U.S. officers were based, triggering a devastating American response. Among the dead were an unknown number of Russian mercenaries from an outfit called Wagner—probably not the 100-plus that some have reported, but more likely fewer than 20.

With these wild swings in fortune for Vladimir Putin, the question becomes: Is he in control in Syria, or stuck in the sand? The honest answer: a bit of both.

Ensuring the survival of Assad’s authoritarian regime in Damascus was never the sole goal of Russia’s intervention. Instead, its purpose was at least as much to inject itself into a crucial geopolitical battleground and force Washington—which, at the time, sought to isolate Moscow diplomatically—to realize that Russia would not be overlooked. It was also to keep Syria from becoming an Iranian vassal; Moscow and Tehran are, at best, frenemies, happy to try to marginalize the United States yet also fierce competitors seeking influence in the Middle East and South Caucasus.

Judging by that criteria, things look pretty good for Moscow right now. The Assad regime once again has momentum, and doesn’t appear headed for collapse. Moscow has also demonstrated that it is not, in fact, just a “regional power” (to use Barack Obama’s phrase, one that Putin clearly resented). It’s a power broker in the Middle East, a spoiler in North Africa, and a partner (of sorts) in Asia, making it at least a global player if not a superpower.

The recent spat between Iran and Israel also comes with its own virtues. Putin’s Russia and Benjamin Netanyahu’s Israel are surprisingly close. Putin understands that while Iran and its client Hezbollah may also be supporting Assad, their vision of Syria is quite different from his own. Following the path he has chosen, Putin can play the role of would-be peacemaker between Israel and the Palestinians, even while watching Iran and Hezbollah get cut down to size. But Putin shouldn’t get too comfortable in Syria.

Many Russians felt a surge of patriotic pride when they learned that Major Roman Filipov, the pilot of a Russian fighter jet shot down in Syria, spent his final minutes after parachuting out exchanging shots with what the Russian Defense Ministry said were Islamist militants. Yet lurking just beneath that pride is the uncomfortable truth that this is not a war dear to many Russians. They tolerate it only so long as they continue to believe it is not going to cost them money and lives.

The need to keep the true costs of the war hidden led Moscow to form Wagner, a pseudo-mercenary unit. It is technically part of a foreign-registered private military company, but one that is Russian-funded, Russian-commanded, and largely Russian-manned. Moscow’s official military aid to Syria is limited largely to air and artillery support and rear-area security. Wagner exists to provide front-line assault troops—whose deaths don’t have to be reported or marked by an official funeral.

With this reliance on soldiers of fortune, it’s unclear how long Putin can keep selling his Syria adventure as a “clean” war. Wagner has absorbed an estimated 100-200 casualties from 2015 up to last December—two to five times the death rate of regular Russian soldiers in Syria. Now that these figures are becoming public knowledge, can Putin avoid a backlash?

In addition to this, Russian nationalists are now demanding some kind of response to the U.S. airstrikes that killed Russian fighters (whichever uniform they were wearing). That’s the last thing Putin needs. After building an image as Russia’s macho champion, he now finds himself weathering criticism not just from liberals but from nationalists who feel he’s failing to live up to his rhetoric.

Is there an end in sight? While Putin essentially declared the Syrian war over back in December, if anything, the conflict has now grown even more complex. Ahead of the March presidential elections, he seems eager to avoid anything that could alarm the Russian people. If Putin withdraws from Syria now, it is essentially handing the country over to Iran, particularly after the failure of his peace talks. Russia is learning the lesson of so many imperial powers past: It’s much easier to get into a Middle Eastern conflict than to get out of one.

As the conflict devolves further, events are almost certain to spin out of the Kremlin’s control. After the Deir ez-Zor attack, the newspaper Kommersant cited a source saying that the Russian command group in Damascus had not authorized this “dangerous initiative.” This could just be a case of retrospective amnesia. But if true, it illustrates the dangers of messy, multi-player conflicts, in which an imperial power must deal with the fallout when its notional clients and proxies take the initiative. When this extends to picking fights with U.S.-backed forces and potentially even threatening U.S. personnel, it’s a dangerous matter. The odds of this escalating into an outright confrontation remain low, but the risk that Moscow might be forced to back down to avoid one is much greater.

For now, Putin has won his desired role as a geopolitical player. So far, he probably feels he’s winning in Syria. But the game is not over, and the costs are rising.