MOGADISHU, Somalia --- Gunmen posing as military forces were holding an unknown number of hostages inside a popular restaurant in Somalia's capital in an attack that began when a car bomb exploded at the gate, police and a witness said, while the extremist group al-Shabab claimed responsibility. At least 17 people, including foreigners, were dead, police and an ambulance driver said.

Two of the gunmen were shot dead and 10 hostages were rescued but five other attackers were thought to remain inside, cutting off electricity to complicate security forces' efforts to end the siege, Capt. Mohamed Hussein said. He said heavy gunfire was heard.

An ambulance driver with the Amin Ambulance service, Khalif Dahir, said early Thursday they had carried 17 bodies and 26 wounded people. Police said the dead included a Syrian man. Most of the victims were young men who had been entering the Pizza House when the vehicle exploded, Hussein said.

Get Breaking News Delivered to Your Inbox

Police said at least nine people had been killed and several wounded in the initial attack. Most of the victims were young men who were entering the Pizza House when the vehicle exploded, Hussein said.

A burst of gunfire was later heard inside the restaurant, Hussein said.

The gunmen "were dressed in military uniforms. They forced those fleeing the site to go inside" the restaurant, witness Nur Yasin told The Associated Press.

Wednesday night's blast largely destroyed the restaurant's facade and sparked a fire. While al-Shabab claimed to have attacked the neighboring Posh Treats restaurant, which is frequented by the city's elite and was damaged in the blast, security officials said the Pizza House was targeted instead.

Security forces rescued Asian, Ethiopian, Kenyan and other workers at Posh Treats as the attack continued, Hussein said.

The Somalia-based al-Shabab often targets high-profile areas of Mogadishu, including hotels, military checkpoints and areas near the presidential palace. It has vowed to step up attacks after the recently elected government launched a new military offensive against it.

Al-Shabab last year became the deadliest Islamic extremist group in Africa, with more than 4,200 people killed in 2016, according to the Washington-based Africa Center for Strategic Studies.

The extremist group also faces a new military push from the United States after President Donald Trump approved expanded operations, including airstrikes, against al-Shabab. On Sunday, the U.S. military in Africa said it carried out an airstrike in southern Somalia that killed eight Islamic extremists at a rebel command and logistics camp.

The operation took place about 185 miles southwest of Mogadishu and was carried out in coordination with U.S. regional partners as a "direct response" to the actions of al-Shabab, which include recent attacks on Somali forces, according to the Pentagon.

"This strike was conducted with the authorities approved by the President in March 2017, which allows the U.S. Department of Defense to conduct legal action against al-Shabaab within a geographically-defined area of active hostilities in support of partner force in Somalia," the Pentagon said in a statement Sunday.

Somalia President Mohamed Abdullahi Mohamed said such attacks would disrupt the group's ability to conduct new attacks.

With a new federal government established, pressure is growing on Somalia's military to assume full responsibility for the country's security. The 22,000-strong African Union multinational force, AMISOM, which has been supporting the fragile central government, plans to start withdrawing in 2018 and leave by the end of 2020.

Also Wednesday, the U.N. Security Council unanimously adopted a resolution extending the U.N. political mission in the Horn of Africa nation, which is trying to rebuild after more than two decades as a failed state, until March 31, 2018. The resolution recognized that "this is a critical moment for Somalia."