The soldiers were detained while travelling from the southern port of Aden to al-Mahra province in eastern Yemen via Ahwar, a city in Abyan province under al Qaeda control.
The militants took them to a remote area and killed them by firing squad, the officials and residents said. They said 17 other captive soldiers were wounded in the incident and some managed to escape and get help from local tribal leaders.
Ansar al Sharia, an al Qaeda affiliate in Yemen, later issued a statement denying responsibility for the attack and blamed a local armed fighter named Ali Aqeel.
“We entered Ahwar around two months ago to chase this corrupt individual and his gang,” the statement said.
The soldiers had been visiting family in Aden and were returning to their base in al-Mahra to draw their salaries, security sources said. They were not dressed in military uniform and were not riding in military vehicles.
Al Qaeda in the Arabian Peninsula (AQAP) has exploited the Yemeni war to expand areas under its control, seizing Mukalla, the capital of Hadramout province, last year and recruiting more followers.
The Saudi-led military intervention in Yemen, backed by the United States, has helped AQAP become stronger than at any time since it first emerged almost 20 years ago, a Reuters special report revealed last week.
Iran-allied Houthi forces have been battling forces loyal to Yemen’s Saudi-backed President Hadi since March 2015 in a conflict that has cost more than 6,200 lives.