Militants stormed a high-end seaside hotel in Mogadishu on Sunday, killing at least seven people and wounding more than 20 as they detonated a car bomb then opened fire with assault rifles in the latest attack in the Somali capital.

Islamist insurgent group al Shabaab said it was behind the assault on the Elite Hotel in Lido beach, and that its gunmen battled security forces who rushed to the scene.

At about midnight, state news agency SONNA said the operation was over and that 205 people had been rescued, “including ministers, lawmakers and civilians,” citing Farhan Qarole, a security forces commander at the hotel.

“All the four militants armed with AK-47 were shot dead. They were aboard the car bomb, they got off … and the four militants went in the hotel to fight,” SONNA said, adding that full details of casualties will be given later.

The hotel is owned by Abdullahi Mohamed Nor, a lawmaker and former finance minister, and is frequented by many government officials and members of the Somali diaspora.

“There were officials of (President Mohamed Abdullahi Farmaajo’s) government inside the hotel when we attacked,” said a statement broadcast on al Shabaab’s Radio Andalus.

The attack follows an uprising at Mogadishu’s central prison on Monday.

SONNA said at least 15 prisoners and four guards were killed when security forces beat back the rebellion.

A witness, Ahmed Ali, said on Sunday he had heard “a huge blast at the hotel, gunfire followed, and then clouds of smoke”.