BEIRUT, Lebanon — Not long ago, rebels on the outskirts of Damascus were peppering the city with mortar rounds, government soldiers were defecting in droves and reports circulated of new territory pried from the grip of President Bashar al-Assad.

As his losses grew, Mr. Assad unleashed fighter jets and SCUD missiles, intensifying fears that mounting desperation would push him to lash out with chemical weapons.

That momentum has now been reversed.