AL MUKALLA, Yemen — Yemeni troops in armored vehicles and backed by airstrikes advanced toward this city of 500,000 people on Sunday, intending to capture it from militants with Al Qaeda who had controlled the major stronghold for more than a year.

Thousands of Qaeda fighters were said to be in the city and appeared ready for the battle against the attacking force, which was backed by the United Arab Emirates. In mosques, the militants asked residents to support them as they confronted “the invaders,” and they placed gas tankers in roads to use as defensive booby traps.

But in the end, hardly a shot was fired. By nightfall, the Qaeda militants had withdrawn from Al Mukalla in an apparently tactical retreat, residents said.

The loss of the city was a blow to the ambitions of Al Qaeda’s Yemeni branch, which is widely considered the militant group’s most dangerous worldwide affiliate, with a particular focus on blowing up commercial airliners. Over the last year, Al Qaeda had used Al Mukalla as a base as the militants stormed through southern Yemen, capitalizing on the power vacuum caused by the country’s 14-month civil war and seizing territory, weapons and money.