"Terrorist elements on Sunday evening attacked... soldiers at a checkpoint" in the town of Loder in Abyan province, the official told AFP, requesting anonymity.
"The exchange of fire lasted half an hour, killing four soldiers and wounding three along with an undetermined number of dead and wounded among the attackers," he said.
Al-Qaeda in the Arabian Peninsula (AQAP) is seen by Washington as the jihadist network's most dangerous franchise.
It and the rival Islamic State group have exploited a power vacuum created by fighting between the government and Shiite Huthi rebels to expand their presence in Yemen, especially in the south.
More From This Section
But its fighters remain active around Loder, the official said.
"They continue to represent a threat to the law enforcement agencies," he said.
AQAP claimed responsibility for a car bombing in the town last week that seriously wounded a senior security official and killed one of his guards, a security source said.