Yemen experienced one of its worst attacks in recent months on Thursday when gunmen stormed the defence ministry in the centre of Sana'a, killing at least 52 people and wounding dozens more.

In an incident described as bearing the hallmarks of al-Qaida, the assailants first detonated a suicide car bomb at one entrance to the heavily guarded building, allowing a second vehicle full of gunmen to enter the complex.

Yemen's higher security committee said 52 doctors and nurses were killed and about 162 people were injured. It did not give a number for officers and gunmen killed.

The ministry's medical clinic appeared to have borne the brunt of the attack, though it was unclear if foreigners were the target. Reuters quoted a medical source and a ministry official as saying the gunmen had shot dead at least two foreign employees, a western doctor and a Filipina nurse, in front of local staff in the courtyard.

Yemen's president, Abed Rabbo Mansour Hadi, immediately ordered an urgent investigation into what was clearly a sophisticated and co-ordinated attack. According to some reports, the gunmen wore Yemeni army uniforms.

Security sources suggested that the assault on what was supposedly one of the most secure buildings in the heart of the capital was timed to coincide with a routine visit to the US by the minister of defence, Mohammed Nasser Ahmed.

It followed recent attacks on military bases in Yemen's eastern provinces of Shabwa and Hadramawt, which have also been blamed on the Yemen-based al-Qaida in the Arabian Peninsula (AQAP), often described as the most dangerous "franchise" of the global terrorist network. It emerged in 2007 after the defeat of al-Qaida in neighbouring Saudi Arabia.

But for most people in Sana'a, the identity of the attackers was second in importance to a seemingly glaring security breach. As nearby streets echoed to the sound of explosions and gunfire and were then closed off to traffic, residents negotiated the aggravated gridlock in a state of shock while army officers struggled to explain how the incident had taken place.

"It's unclear how it happened – it's shocking. Many of our colleagues are dead," said one officer manning a checkpoint blocking the road to the ministry. "I guess mistakes happen."

Yemen remains in the midst of a fraught, post-Arab spring transition that saw its veteran president, Ali Abdullah Saleh, surrender power. Dozens of military and security officers have been assassinated, while an MP affiliated with the Houthi rebel group was gunned down while leaving a mosque just weeks ago. The identity of the perpetrators is unclear.

No definitive claim of responsibility was made for the ministry attack, which bore a resemblance to a deadly 2008 assault on the US embassy, which was carried out by al Qaida-affiliated operatives.

"It bears all of the hallmarks of al-Qaida," said Abdul-Ghani al-Iryani, a Yemen-based political analyst. "There is the possibility of collaboration on the inside of course … but I believe that this was an attack meant to send a message to the Yemeni government as they increase their co-operation with the US on counter-terrorism matters."

Security in Yemen has become an international concern because of its proximity to Saudi Arabia and the discovery of terrorist plots being hatched against the US and Britain. Controversial US drone attacks are mounted regularly from a secret air base inside Saudi Arabia.

In August, a US warning of a possible major terrorist attack in the Middle East prompted the closure of several western diplomatic missions in Yemen and US missions in several other Arab states.

In July last year, a suicide bomber in Yemeni army uniform killed more than 90 people rehearsing for a military parade in Sana'a. AQAP later claimed responsibility.

Little is known about AQAP's links with al-Qaida central in Pakistan. But it is sustained by local factors including wild terrain, economic misery, tribal divisions and the weakness of the Yemeni state.