At least 15 people have died after a suicide car bomber crashed into a gate outside a hotel frequented by MPs in Mogadishu and gunmen then stormed the building, police say.
Police said among the dead were two MPs. They had previously said at least 10 people were killed.
"Lawmakers Mohamud Mohamed and Abdullahi Jamac died in the hotel. They lived in it," Major Ibrahim Hassan, a police officer, told Reuters.
"Many other people including lawmakers were rescued. The operation is about to end now. So far the death toll we have is 15 dead and 20 others wounded."
Militants from al-Shabaab, a group affiliated with al-Qaeda, quickly claimed responsibility for the attack on the Hotel Ambassador in the centre of the Somali capital and said it had killed 20 people in addition to the two lawmakers.
"We targeted the members of the apostate government... We killed many of them inside and we shall give details later.
"Our mujahideen are on the top floor of the hotel building," Sheikh Abdiasis Abu Musab, al-Shabaab's military operation spokesman, told Reuters.
Authorities could not immediately verify al-Shabaab's statement.
Residents and a Reuters reporter at the scene of the attack said they could still hear sporadic gunfire.
Colonel Ali Mohamed, a Mogadishu police officer, said the hotel was hit by a car bomb that rammed its gate.
Hassan had said earlier police suspected al-Shabaab fighters were still present in the hotel state-run Radio Mogadishu had said government forces were still at the scene rescuing people from the hotel.
Al-Shabaab was pushed out of Mogadishu by African Union peacekeeping forces in 2011. But it has remained a potent threat in Somalia, launching frequent attacks aimed at overthrowing the Western-backed government.
Maka Al Mukaram, where Wednesday's attack took place, is a major street lined with hotels, restaurants and banks in the heart of the capital. It links another major artery, K4, to the presidential palace.
Before the hotel attack, government officials on Wednesday announced two strikes against the militants - one in which the head of the al-Shabaab intelligence unit was killed, and another which killed the suspected mastermind of an attack on a university in Kenya, in which 148 people died last year.