At least four militants from the jihadist group al-Shabab have been killed, after they attacked a training compound used by the Somali intelligence agency Sunday, according to media reports.

A suicide car bomb was detonated near the national intelligence headquarters in the country's capital, Mogadishu, on Sunday morning. The sound of heavy gunfire was subsequently reported in the area.

Somali government officials said that they have "foiled the attack" and four militants are dead, according to a BBC report.

The car bomb killed two attackers and one government soldier, police Capt. Mohamed Hussein told the Associated Press Sunday. He said soldiers then shot two gunmen who had seemingly lost their way and stormed a civilian house close to their target. Other Somali officials told reporters, however, that no government troops had been killed.

A spokesman for al-Shabab, which wants to topple the Western-backed government in Mogadishu, told Reuters that the group's fighters had killed more than 10 intelligence officials.

"We captured the building and we are fighting inside it," Sheikh Abdiasis Abu Musab, al-Shabab's military operations spokesman, told Reuters on Sunday.

On Saturday, al-Shabab fighters killed at least eight officers in a a separate raid on a police station near the capital, police and the militants said.

The attack is the latest in an escalating wave of assaults that the group have launched recently. The militants have pledged to step up their attacks on government forces during the holy month of Ramadan. Fighters loyal to the group stormed a military base in southwest Somalia Thursday, killing 16 government soldiers, just hours after launching a separate deadly attack in central Somalia.

Al-Shabab has been pushed out of much of the territory they controlled by Somali troops, backed by African Union forces, but they remain a threat, carrying out guerrilla attacks on government and civilian targets, according to the Associated Press.