At least 38 people have been killed in attacks on military targets in Yemen, officials say, with two car bombs exploding at a base and a separate shooting targeting soldiers.

The car bombs detonated on Friday at a military camp in Shabwah in southern Yemen, officials said.

Shabwah, a lawless and rugged province of Yemen, has been the scene of much fighting in recent years between armed groups and the security forces.

A military statement said 20 people - soldiers and police officers - were killed at two posts.

Separately, assailants killed about 10 soldiers in an attack on a military headquarters in the town of Mayfaah, a security official told the Reuters news agency.

A military statement said that the attacks were carried out by Al-Qaeda in the Arabian Peninsula (AQAP), the regional branch of the al-Qaeda network.

Hallmarks of AQAP

Al Jazeera's Hashem Ahelbarra said that though there was no claim of responsibility yet, the attacks bore all the hallmarks of AQAP.

"These type of attacks are always a signature weapon of al-Qaeda: daring, very sophisticated attacks using bombs planted in vehicles or suicide bombers," he said.

"We know that al-Qaeda is very, very strong. You're not talking about dozens; you're talking about thousands of fighters, and not only from Yemen."

In Friday's first attack, a concealed bomb in one car exploded among a group of soldiers at the gate of the camp in Shabwah as the driver tried to enter the camp.

The other was already inside the camp when it exploded, Reuters reported.

The attackers later stole vehicles belonging to the security forces and escaped, local residents said.

AQAP and allied groups took advantage of political chaos in Yemen in 2011 to seize control of some towns and surrounding areas in the south of the country.

They were beaten back by Yemeni forces with assistance from the US last year but have continued to stage attacks against government and military targets.

Armed groups have assassinated dozens of Yemeni security and military officers in southern provinces including Shabwah over the past two years, often using car bombs or in drive-by shootings.