It was not clear if soldiers reportedly taken hostage by the militants at the beginning of the siege have survived. Maj Gen. Mohsen Nasser told the Associated Press that all the militants were killed in the operation, which followed three hours of intense clashes. He said hostages are believed to be freed, but he didn't have a count of the number held.
The gunmen had planted explosives and deployed snipers to keep security forces away, officials say.
The militants, dressed in fatigues and riding in military trucks, overran the base on Monday and took an unknown number of soldiers hostage. The military sent in reinforcements and surrounded the building.
Nasser said the militants had refused to surrender, forcing authorities to storm the building.
More From This Section
The brazen attack and the standoff underscored al-Qaida's ability to stage ambitious attacks that exploit lax security in Yemen.
Meanwhile, a Yemeni national security court opened an investigation into three former top military officials including a nephew of the former president for alleged negligence in connection to a 2012 suicide attack on a military parade that killed more than 90 conscripts, security officials said.
The court said the senior officials, including the nephew of former President Ali Abdullah Saleh, were not present during the attack. The court said this was evidence they were implicated in the attack, the officials said. Lawyers for the accused could not immediately be contacted.
Separately, officials say suspected al-Qaida militants killed four soldiers in an attack on a military checkpoint in the southern Hadramawt province.
Officials spoke on condition of anonymity because they were not authorized to brief the media.