Russian President Vladimir Putin, center, shakes hands with Syrian President Bashar al-Assad in Moscow on Oct. 20. (Alexei Druzhinin/Associated Press)

VLADIMIR PUTIN once again appears to have surprised the Obama administration, this time with an abrupt announcement of a military withdrawal from Syria. As in several previous instances — his seizure of Crimea and incursion into eastern Ukraine, for example — the White House was caught flat-footed because it deluded itself about Mr. Putin’s goals and his chances of success. President Obama derided the Russian leap into the war in September as the prelude to a “quagmire,” just as he proclaimed that the annexation of Crimea and invasion of the Donetsk region would be self-defeating. Yet in Syria, Mr. Putin has accomplished quite a lot, and his gains have come at the expense of U.S. interests and of Mr. Obama’s stated goals in the region.

Moscow’s most obvious achievement has been to reverse the course of the civil war. The regime of Bashar al-Assad, which was reeling last summer, now has a clear upper hand over U.S.-backed rebels. By the Russian account, regime forces have regained control over 400 towns and almost 4,000 square miles of territory; they have cut off the main supply line to the rebel-controlled districts of Aleppo, the country’s largest city. The cease-fire negotiated by Mr. Putin’s foreign minister with Secretary of State John F. Kerry could lock those gains into place — and government forces have continued to attack key areas during the cease-fire, without consequence.

More broadly, Mr. Putin has succeeded in reestablishing Russia as a power in the Middle East. The United States has been obliged to accept Russia as a co-equal in brokering the cease-fire and a new round of peace talks, and has swallowed Mr. Putin’s terms — including setting aside a demand that Mr. Assad give up power in the near future. Having shattered the Kremlin’s diplomatic isolation after the Ukraine invasion and established himself as a key player in determining whether the flow of Syrian refugees to Europe will continue, Mr. Putin is positioned to seek the lifting of European Union sanctions on his regime this summer.

U.S. officials argue that the cease-fire has brought relief to millions of Syrians, as violence has declined and relief convoys have reached besieged areas. But the humanitarian costs of Russia’s intervention also have been heavy. Human rights groups and other independent observers have charged Russia with deliberately targeting hospitals and food stores and dropping cluster munitions that killed hundreds, if not thousands, of civilians. Russia has paid no price for these crimes.

The withdrawal may suck some wind from the sails of Mr. Assad, who has been ostentatiously promising to reconquer all of Syria. That, too, suits Mr. Putin. Like Ukraine, and Georgia, Syria could best serve his interests as a frozen conflict, where Russia can protect its strategic position in a divided country and exercise a veto over any permanent solution, while avoiding a long-term military commitment. The United States and its allies will be left to carry on the fight against the Islamic State, which will be made considerably more difficult by the Assad regime’s survival. Thanks to Mr. Putin’s intervention, and the United States’ befuddled response to the Syrian crisis, it is not he but Mr. Obama who is left facing a quagmire.