At least 20 people, including a pregnant woman and a child, were killed and several others wounded in a terror attack on a popular beachside restaurant in the capital of Somalia.

A group of heavily armed gunmen stormed and took over the Beach View hotel and the Lido Seafood restaurant in Mogadishu on Thursday, according to CNN. The militants indiscriminately fired on the diners and detonated two car bombs at the entrance of the restaurant.

"They randomly fired at the people sitting near the beach before entering the restaurant,'' an eyewitness told Associated Press.

Somali security forces ended the siege after almost eight hours of gunfight with the militants. At least 17 people were injured in the attack.

"Luckily I survived but my friends died on the spot. I saw windows being smashed and people began to run here and there. What a world we live in. There is almost no place safe anymore," eyewitness Abdullah Biid told The Christian Broadcast Network.

The United Nations condemned the attack, calling it an "outrageous action" aimed to disturb peace and stability in the country.

"Such outrageous actions must not undermine efforts to restore peace and stability to Somalia. This latest atrocity by Al-Shabaab is very deliberately intended to intimidate Somali civilians," Secretary General special representative Michael Keating said, according to UN News Center.