Security forces patrol outside a building which was attacked by suspected Al Shabaab militants in the Somalia's capital Mogadishu, on Feb 21, 2023. (PHOTO / AFP)

MOGADISHU – Ten people were killed in an attack in Somalia's capital claimed by the al Qaeda-linked al Shabaab group, which said it was targeting military officials and militia fighters involved in an offensive against it.

The Tuesday attack began with a car bomb blast followed by a gun fight that went on for hours at a house in Mogadishu where several lawmakers were believed to be staying, a witness told Reuters.

Al Shabaab has stepped up attacks in a show of resurgence since President Hassan Sheikh Mohamud's government launched an offensive against the group in August

Somalia's information ministry said late on Tuesday that 10 civilians were killed, but did not say who was targeted. Security forces killed the four militant gunmen involved in the assault, it said.

Al Shabaab has stepped up attacks in a show of resurgence since President Hassan Sheikh Mohamud's government launched an offensive against the group in August.

ALSO READ: Somalia's neighbors to start new operations against al Shabaab

A suicide bomber first detonated a car outside the house and then al Shabaab militants stormed in while firing guns, said witness Farah Aden.

The fighting between the al Shabaab fighters and security forces lasted for about eight hours, according to al Shabaab, the information ministry and witnesses.

"Other militants went in and killed 10 civilians inside the house. The security forces shot dead the four militants who stormed the building," the information ministry said in a statement late on Tuesday.

Four soldiers and three civilians were wounded before the fighting ended, it added.

Al Shabaab said in a statement it had killed 70 people in the attack, which targeted the house because it offered accommodation to military officials and wounded militia members from the central Hiraan region recovering from fighting against the group there.

READ MORE: Suspected al Shabaab militants attack Somalia military base

The government and al Shabaab, which has in the past launched attacks on hotels, military bases and government establishments, often give differing casualty figures.

Government forces and allied clan militias known as macawisley, pushed al Shabaab out of Hiraan last year.