A Somali soldier and four militants were killed Sunday as an Al Qaeda-linked extremist group tried to attack a training compound used for intelligence officials in Mogadishu, a police officer said.

The attack started with a suicide car bombing outside the intelligence school, which killed two attackers and a soldier, police Capt. Mohamed Hussein said Sunday. He said soldiers then shot two gunmen who had seemingly lost their way and stormed a civilian house close to their target.

The Al Qaeda-linked al-Shabaab group, which is waging an insurgency against Somalia's Western-backed weak government, claimed responsibility for the attack through its radio station.

Al-Shabaab has vowed it would step up attacks against government and African Union forces in Somalia during the Muslim holy month of Ramadan.

The militants have been pushed out of much of the territory they controlled by African Union troops, which are backing the Somali troops, but they remain a threat, carrying out guerrilla attacks on government and civilian targets.