A suicide bomber detonated his explosives-laden car Thursday at Yemen's Defence Ministry, killing 18 soldiers and wounding at least 40 in an attack underlining the persistent threat to the stability and security of the impoverished Arab nation, military and hospital officials said.

Officials said as many as 12 gunmen also were killed in a firefight between troops and a carload of attackers who arrived minutes after the early morning blast, apparently in a bid to take over the complex in downtown Sanaa, Yemen's capital.

They said the gunmen were armed with assault rifles, hand grenades and rocket-propelled grenades. They wore Yemeni army uniforms, the officials said.

There was no immediate claim of responsibility for the attack, which bore the hallmarks of al-Qaeda, whose chapter in Yemen is considered among the world's most active.

The Defence Ministry issued a brief statement saying "most" of the gunmen had been killed, but did not say how many there were or give any other details. Yemen's defence minister was in Washington on Thursday for talks with U.S. officials.

President Abed Rabbo Mansour Hadi later arrived at the scene of the attack and met with military commanders inside the complex. He also ordered an investigation into the incident, the military officials said.

The officials said the blast badly damaged a hospital inside the complex, started a fire and blew out windows and the doors of homes and offices in the immediate vicinity. The blast and the subsequent gunfight destroyed an armoured vehicle belonging to the army and reduced three civilian cars outside the complex to charred skeletons, witnesses said.

The officials spoke on condition of anonymity because they were not authorized to speak to journalists.

Chaotic aftermath

Associated Press video shot shortly after the attack showed its chaotic aftermath: a vehicle engulfed in flames as soldiers and ambulances arrived at the ministry. Gunfire echoed in the streets as sirens wailed.

Military helicopters hovered over the site after the blast and state television aired calls for blood donations.

APTOPIX Mideast Yemen

Officials said the blast badly damaged a hospital inside the complex, started a fire and blew out windows and the doors of homes and offices in the immediate vicinity. (Mohammed Hamoud/The Associated Press)

Al-Qaeda militants are concentrated in the southern and eastern parts of Yemen, but they occasionally strike in the capital. They took advantage of the tenuous security prevailing in 2011 and 2012 during an uprising against then-President Ali Abdullah Saleh by seizing territory in the south. The government has since recaptured al-Qaeda-held areas.

Yemen is strategically located at the southwest corner of the Arabian Peninsula, bordering Oman and Saudi Arabia, two of Washington's closest Arab allies. Yemen has a shoreline on the Red Sea and the Arabian Sea close to the vital shipping lines carrying oil from the energy-rich Gulf region to the West.

The United States has been helping Yemen combat the threat of al-Qaeda, training Yemeni special forces, supplying them with arms and exchanging intelligence with the Sanaa government.

U.S. drones and airstrikes against al-Qaeda hideouts in Yemen are common. They also target suspected members of the network.