ISTANBUL—Not long after U.S. cruise missiles tore into the Syrian air base that apparently served as the launch point for a chemical-weapons attack, the Syrian army’s chief of staff arrived to inspect the damage and commend the pilots.

They were the same pilots who flew their warplanes to the town of Khan Sheikhoun, where more than 100 civilians died.

Embracing the base pilots, presumably including those responsible for the chemical attack, Gen. Ali Abdullah Ayyoub praised the “high morale and fighting spirit” of the officers and soldiers at the Sharyat base. They in turn pledged to continue “rooting out terrorism wherever it exists in the homeland,” the official SANA news agency reported in a video.

In actual fact, Syrian forces probably carried out the gas attack out of desperation, according to U.S. military officials and Syrian rebel officials. And morale among regime forces may have hit a new low.

Since the attack, the Syrian air force has moved warplanes from several bases to the Russian-controlled Hmeimim base near Latakia, and Russia has taking over most air operations in central and northern Syria, according to rebel plane-spotters who monitor regime and Russian air movements.

These sorties included at least seven assaults against civilian targets on Friday alone, and as many again on Saturday. In a Russian air attack Saturday on Urom al-Joz, a small town in Idlib province, 20 civilians were killed. Khan Sheikhoun was targeted as well both days.

Regime forces have been plagued by desertions at every level since 2012, but ever since Russia’s air intervention began in September 2015, the government has managed to recapture rebel-held territory. It achieved its biggest victory in December, when forces led by Assad’s Iranian and Hezbollah allies expelled rebel troops and much of the population from east Aleppo.

But morale plummeted again a few weeks ago when U.S.-backed rebel forces, supported by Islamists the U.S. view as terrorists, scored rapid advances in Hama province. U.S. officials and rebel spokesmen say the dramatic advances are probably what prompted the Syrian military’s turn to chemical weapons.

“The Syrian regime has been under intense pressure,” a senior U.S. military official told reporters in Washington on Friday. He said rebels in an advance last month threatened to capture the Hama airfield, a key base for helicopters and a suspected barrel bomb manufacturing facility.

Barrel bombs, consisting of shrapnel and metal scraps packed into a barrel with explosives, are dropped routinely from helicopters over residential areas in rebel-controlled zones throughout Syria.

Losing the Hama base was a “significant risk” to the regime and U.S. analysts judged that the use of chemical weapons was “linked to a battlefield desperation decision to stop the opposition from seizing those key regime elements.” The official could not be named under the rules of the briefing.

A Syrian rebel spokesman spoke of enormous government losses on the ground since the offensive began March 21. Hours after the battle began, the U.S.-supported force captured more than 20 towns and villages, as well as 50 military outposts in the Hama countryside, said Lt. Mahmoud Mahmoud, spokesman for the Izza Army, a moderate rebel group, in a WhatsApp conversation. Regime forces “withdrew without showing any resistance,” he said, and rebels advanced to within a few miles of the military airport, which is about 50 miles northwest of Shayrat.

The surprise attack threw regime forces off-balance, and at one point regime warplanes were bombing regime positions, Mahmoud said. He claimed the regime lost more than 700 fighters. He said rebels have documented the capture or destruction of 40 regime tanks and armored personnel carriers, the destruction of 13 tanks and a great many artillery pieces.

Mahmoud said Syrian conscripts fighting for the Assad regime appeared exhausted, and commanders judged that government-sponsored Syrian militias do not have the will to fight. The only force that moderate rebels have to reckon with is the Lebanese Hezbollah and other militias Iran has shipped into Syria from Iraq, Afghanistan, and other countries.

The U.S. had cut support to the rebel fighters late last year when the latest cease-fire went into effect, but Mahmoud said rebels began receiving TOW anti-tank missiles and other small weapons after they regrouped and established a new joint operations center in Hama province.

Within days of the setback in Hama, Syrian regime forces began using chemical weapons.

On March 25, a date also confirmed by the senior Pentagon official, a regime helicopter dropped a barrel bomb full of chlorine gas on a medical center in the town of Lataminah, north of Hama, killing two people, injuring 30 and putting the medical facility out of service. The next day a second barrel bomb containing chlorine was dropped on an Izza Army position in the same town, and at least 20 fighters reported difficulty breathing.

On March 30, additional barrel bombs containing chlorine were dropped on Lataminah and a nearby village, causing vomiting, dizziness, and breathing difficulties. Then on April 3, a barrel bomb was dropped on the town of Habit, south of Khan Sheikhoun, causing at least 20 people to experience difficulty breathing.

The munitions had the intended impact. “With these weapons in use, we thought it a big mistake to hold the ground, especially because so many of our fighters were affected by the gasses,” Mahmoud said. “We were forced to withdraw to rear locations.” He said the regime’s gas attack on Khan Sheikhoun was clearly “revenge against civilians” for the rebel advances.

“The regime was simply trying to press the rebels to stop their military advance in north Hama,” he said. “They think the rebels’ morale will be destroyed by the attack on Khan Sheikhoun and other places. But we have simply become more determined and we will continue our battles,” he said.