Mogadishu, Somalia (CNN) -- Al-Shabaab militants launched an attack Somalia's parliament headquarters Saturday, leaving at least 10 people dead and more than 11 others wounded, witnesses and officials said.
Members of the parliament were among those wounded after gunmen loyal to the al Qaeda-affiliated terror group stormed the facility in Mogadishu, according to witnesses and official accounts.
Fighters used automatic rifles, heavy machine guns and explosives in an attack that lasted more than three hours, witnesses said.
Mohamed Madale, a police spokesman, said security forces later secured the building after the fighters blew themselves up. He said the security forces killed several fighters during the attack.
Dahir Mohamed, a police officer who witnessed the attack, said the attackers used a car filled with explosives to get into the parliament building, and killed some of the Somali forces guarding the building on their way in.
Smoke and flames could be seen pouring from the building as ambulances pulled up to attend to the wounded lying on the ground. People took cover as security forces moved in, exchanging gunfire with the attackers. Some members of parliament were evacuated from the building.
Ali Osman, an ambulance worker at the scene, told CNN that he collected 10 bodies, including those of Somali forces, civil servants and civilians who were caught in the crossfire during the attack.
He also said more than 11 others, including members of parliament, also were wounded.
A spokesman said on Al-Shabaab's radio network that the group was responsible for the attack.
Prime Minister: Attack does not reflect "true Islamic faith"
In a statement condemning the attack, Somali Prime Minister Abdiweli Sheikh Ahmed said, "The terrorists have once again shown that they are against all Somalis, by killing our innocent brothers and sisters. These cowardly, despicable actions are not a demonstration of the true Islamic faith."
The U.S. State Department issued a statement condemning the attack.
"We extend our sympathies and condolences to those affected by this heinous act of terrorism," deputy spokesperson Marie Harf said in the statement, "and commend Somali and African Union forces for their swift and courageous response."
"We continue to stand firmly with the Federal Government of Somalia and the many international partners working to support its efforts to root out the threat posed by al-Shabaab and to build a more secure and prosperous future for the Somali people," Harf said. "Cowardly acts such as these will not shake our resolve."
Lawmakers witness carnage
Mohamed Omar, a lawmaker who was inside the parliament building, said that Al-Shabaab fighters wore military uniforms and "suicide belts." Security forces killed at least three of the militants, Omar said.
Osman Daallo, a member of parliament, said he saw two colleagues seriously wounded, including a fellow MP "whose chest was gushing out from blood."
Mohamed Deyfalah, another MP, said the attack was the worst he has ever witnessed, and he had always believed the heavy security presence at the parliament would have prevented such an attack.
One of wounded MPs who asked to remain anonymous said the attack "indicates the weakness of the government."
"Our government is still unable to deal with the terrorists and today's attack underscores a lack of efficient government," the lawmaker said.
Late Saturday, Somalia's security minister, Abdukarim Hussein Guled, resigned as a result of the attack.
"I bear witness that the 22 months I have been in the office, we managed to improve the security situation of the country, especially Mogadishu," the minister said, "but now it is time to resign so that someone else who is better than me can take over the office."
Al-Shabaab's aim is to turn Somalia into a fundamentalist Islamic state, though it has carried out attacks in other African countries, as well. The group carried out the mall attack in Nairobi, Kenya, in September that left at least 67 people dead.
The group has increased the use of suicide attacks in recent years, though these have been somewhat rare in Somalia. It is believed that veterans of the wars in Iraq and Afghanistan are helping train al-Shabaab fighters.
CNN's Brian Walker contributed to this report