The offensive in Shabwa is also the latest phase of an increased American campaign against Al Qaeda’s branch in Yemen since President Trump took office. Known as Al Qaeda in the Arabian Peninsula, it is widely considered the terrorist group’s most dangerous worldwide affiliate, with a particular focus on trying to blow up commercial airliners.

Here and elsewhere in the country’s central and southern regions, American-backed Yemeni forces have been waging a shadow war against more than 3,000 members of the Qaeda affiliate and their tribal fighters. Since Feb. 28, the United States has conducted more than 100 airstrikes against Qaeda militants in Yemen, according to the Pentagon, nearly three times the total for all of last year.

The Yemenis in recent weeks have also captured some important Qaeda operatives. Their interrogations have given the Yemeni forces and their American and Emirati partners valuable insights into the insurgents’ leadership hierarchy, propaganda plans and local networks, a United States official said.

Here in Azzan, Mr. Wahidi said that residents had been tipped off about the impending attack by homegrown troops in the advancing force. “Those are our sons,” Mr. Wahidi said as he reclined on a hard pillow and chewed khat, the narcotic leaves widely consumed in Yemen and the Horn of Africa. “Most of the soldiers graduated from Azzan secondary school.”

The night before, residents said, warplanes hovered over the town and dropped flash bombs at suspected Qaeda militants gathering in the nearby mountains. Ahead of their arrival, the Yemeni troops also fired machine guns that rocked the town, another tactic to scare the militants.